Hello everyone! I’m just starting now developing with blynk and i’m loving it!
I have a small problem where. I’m reading temperatures using a ds18b20 to arduino nano and sending the information via usb. I can control the nano using the blynk interface and read the temperatures if i use the value display widget. but if i use the graph widget, it doesn’t load anything.
Can you guys help me?
this is the code i’m using:
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
#define BLYNK_PRINT SwSerial
#include <BlynkSimpleSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "___________";
#define ONE_WIRE_BUS 10
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup()
{
SwSerial.begin(9600);
Blynk.begin(auth);
// Default baud rate is 9600. You could specify it like this:
//Blynk.begin(auth, 57600);
sensors.begin();
}
void loop()
{
Blynk.run();
sensors.requestTemperatures(); // Send the command to get temperatures
float temp = sensors.getTempCByIndex(0);
Blynk.virtualWrite(1,temp);
}