What have I done wrong. I compiled my project and linked it to Blynk mobile. After only a couple of hours I now find I cannot use it anymore as the Message limits has been reached (30 day lockout). Its just a temperature monitor but was going to go further with it.
Here’s the code
/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "TMPL5EWfQ8Y8R"
#define BLYNK_TEMPLATE_NAME "ReefTank Control"
#define BLYNK_AUTH_TOKEN "pwCwhBq6aJooO3Un5ieVqnc9jT7WEk1J"
/* Comment this out to disable prints and save space */
// #define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// the following are extra for temperature
// #include <SimpleTimer.h> *** no simple timer found
#include <OneWire.h>
#include <DallasTemperature.h>
// WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "txxxxxxxxxxx";
char pass[] = "Yxxxxxxxxxxxx";
BlynkTimer timer;
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board "D4 pin on the ndoemcu Module"
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
float Fahrenheit=0;
// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0)
{
// Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V1, value);
}
// This function sends Arduino's uptime every second to Virtual Pin 2.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V2, millis() / 1000);
}
void setup()
{
// Debug console
Serial.begin(115200);
//Connecting to Blynk Cloud
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
DS18B20.begin();
timer.setInterval(1000L, getSendData);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
/***************************************************
* Send Sensor data to Blynk
**************************************************/
void getSendData()
{
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0); // Celcius
Fahrenheit = DS18B20.toFahrenheit(temp); // Fahrenheit
Serial.println(temp);
Serial.println(Fahrenheit);
Blynk.virtualWrite(V3, temp); //virtual pin V3
Blynk.virtualWrite(V4, Fahrenheit); //virtual pin V4
}