I am building a code that will let the user to ( without any config button )
power on the device ( esp8266 + 2 rele ) and get a captive portal
from there set up ssid/pass/auth token, save
then the device will connect to the wifi network and connect to blink
Up to here, its done, its working just fine. But in the future if I want to add a second device ( 2 rele output) and use the same token to build under the same project 2 different buttons and have 4 buttons for 2 devices, 2 rele each, V1 V2 V3 V4 , I need to define some way in my code that each chanel of each board will be subscribed to a specific Virtual Pin, and this is my problem
I already know how to build the website, save the spiff, read a json file, and parse it to get the Int value, but that I dont know is how to define that under de Blynk library
At the moment I am using arduino IDE and I am using this way to define a code outside the setup / loop
I would need some way to put this code inside the setup function
BLYNK_WRITE(20) {
if (param.asInt()) {
//HIGH
digitalWrite(2, LOW);
} else {
//LOW
digitalWrite(2, HIGH);
}
}
Because I will need to NOT hardcode the “20” value, I already have a variable called
int VirtualPinChanelA = myspiff::loadspiff("/ch1.txt").toInt(); but If I use the BLYNK_WRITE definition inside the setup it fails