Streaming in an Arduino Sketch

Github repo and detailed documentation can be found here:

https://github.com/InitialState/arduino_streamers

Each of the following example sketches should be very easy to adapt for other WiFi shields or boards. The sketches construct HTTP calls to our RESTful Events API.

 


 

Example Sketches

 
Ethernet Shield Arduino Yun ESP8266 WiFi Shield

 

Arduino Ethernet Shield


Simply modify line 58 with YOUR_ACCESS_KEY and YOUR_BUCKET_KEY.

 

Arduino Yun


Initialize the Sketch

You just need to replace the accessKey with one from your account, specify the bucketKey and bucketName, provide the number of signals you will be streaming, and name your signals.


Stream your Event Data

Simply remove the random number generation in setup() and set signalData[] equal to whatever is providing your events. Make sure that your data is converted into Strings.
Depending on what you are measuring, you will want to change the delay time.

ESP8266 WiFi Shield


Initialize the Sketch

You just need to replace the accessKey with one from your account, specify the bucketKey and bucketName, provide the number of signals you will be streaming, name your signals, and enter your WiFI SSID and password.
The board used for this sketch was the Cactus Micro.


Stream your Event Data

Simply remove the random number generation in setup() and set signalData[] equal to whatever is providing your events. Make sure that your data is converted into Strings.
Depending on what you are measuring, you will want to change the delay time.
The truncateString function is only needed if you have a TCP buffer size (like the Cactus Micro).