I’m an old blynk legacy user but I don’t understand the current blynk iot format. how do I convert it?
I have code with header and footer format like this.my board code is Nodemcu with wifi manager
#include <FS.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
#include <SimpleTimer.h>
#include <DHT.h>
char blynk_token[34] = "BLYNK_TOKEN";
//flag for saving data
bool shouldSaveConfig = false;
//callback notifying us of the need to save config
void saveConfigCallback () {
Serial.println("Should save config");
shouldSaveConfig = true;
}
bool pirEnabled = false;
BLYNK_WRITE(V1){
int control4DigitalPins = param.asInt();
if(control4DigitalPins == 1){
digitalWrite(D1, HIGH);
digitalWrite(D2, HIGH);
digitalWrite(D3, HIGH);
digitalWrite(D7, HIGH);
}
else{
digitalWrite(D1, LOW);
digitalWrite(D2, LOW);
digitalWrite(D3, LOW);
digitalWrite(D7, LOW);
}
}
.....................
.......................
....................
.................
dht.begin();
// Setup a function to be called every second
timer.setInterval(10000L, sendWifi);
timer.setInterval(1000L, sendSensor);
}
void sendWifi()
{
Blynk.virtualWrite(V2, map(WiFi.RSSI(), -105, -40, 0, 100) );
}
void loop()
{
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates SimpleTimer
}
and I also took a sample program from the new blynk iot like this
// Fill-in information from your Blynk Template here
//#define BLYNK_TEMPLATE_ID "TMPLxxxxxx"
//#define BLYNK_DEVICE_NAME "Device"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG
// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
//#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI
#include "BlynkEdgent.h"
void setup()
{
Serial.begin(115200);
delay(100);
BlynkEdgent.begin();
}
void loop() {
BlynkEdgent.run();
}
how do i convert it? thank you for helping because only now i want to switch to the new blynk iot