I didn’t understand very well how to send data from Arduino to Blynk. Could you, guys, explain me how i can do this? What’s wrong in my code?
thanks
Have you looked at the examples in the library? There is an example written specifically for your needs.
**************************************************************
* This example shows how value can be pushed from Arduino to
* the Blynk App.
*
* For this example you'll need SimpleTimer library:
* https://github.com/jfturcot/SimpleTimer
* Visit this page for more information:
* http://playground.arduino.cc/Code/SimpleTimer
*
* App dashboard setup:
* Value Display widget attached to V5
*
**************************************************************/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
SimpleTimer timer;
void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth);
// Setup function to be called each 1000 milliseconds
timer.setInterval(1000, sendUptime);
}
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendUptime()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(5, millis()/1000);
}
void loop()
{
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates SimpleTimer
}
Please read all the instructions carefully and I hope you’ll succeed. Don’t forget to install SimpleTimer library.
blynk.cpp.o: In function `setup':
C:\Program Files (x86)\Arduino/blynk.ino:54: undefined reference to `SimpleTimer::setInterval(long, void (*)())'
blynk.cpp.o: In function `loop':
C:\Users\Daniel\Documents\Arduino\libraries\blynk-library-0.2.1/Blynk/BlynkProtocol.h:155: undefined reference to `SimpleTimer::run()'
blynk.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Program Files (x86)\Arduino/blynk.ino:40: undefined reference to `SimpleTimer::SimpleTimer()'
collect2.exe: error: ld returned 1 exit status
Appers this error.Do you have any ideia how to solution that?
I too am having trouble with this project. I too uploaded Pavel’s code from above and added my auth key, but don’t know how to setup the app to receive the data that is being sent every 3000 ms. I want to go through these exercises to learn how to retrieve data collected by a DHT22 on Arduino Mega with Ethernet. There only seems to be fragmented info in this forum. I also stumbled onto an Instructable that involved a DHT, Arduino and ESPXXXX (wifi?), but was unable to make sense of it. My code skills are rough, and I believe I need more info than what I have been able to find thus far.
Can someone help either with code, app setup and/or explanations?