- Tue Sep 29, 2015 12:00 am
#30083
Yes, it is possible to send data at set intervals.
I've been experimenting and set up a demo program that reads a value from a photoresistor and sends the data both as an HTTP GET request and as an OSC message.
I'm using the Arduino IDE for this with a OSC library I found.
This is a stripped-down version (no OSC, just a loop for HTTP GET):
https://gist.github.com/Neurogami/598648dfb0f6372ad376Basically, though, you use setup)( to get connected to your wireless network, and then in loop() you build yur URI and send whatever HTTP request you want. Then delay() for some period of milliseconds.
Now, the thing that receives that request needs to understand HTTP GET requests. It need not be a full-blown Web server but has to do at least than much.
A problem with that is in knowing the IP address of your phone and making sure the ESP8266 code uses it. Phone IPs can change (though some devices will let you set a static IP).
Plus, if your phone app is handling an HTTP request every 10ms you may find it getting a bit warm and the battery draining. (I think; this might not be as CPU intensive as I'm guessing.)
This is where using OSC over UDP might be a better choice.
I'm pretty sure this is the Arduino library I'm using:
https://github.com/sandeepmistry/esp8266-OSCHere's a simple example:
https://gist.github.com/Neurogami/088fb292454f9be9fa92Hope this helps.