Hi! I’m new to arduino i was using this sketch below with arduino uno with blynk app to monitor a magnetic switch on off status. After i purchase the wemos d1 r2 esp8266 to go wireless i try to upload the same sketch to the wemos d1 r2 but virtual pins are not working.
Can anyone please help me with that . Thank you: Constantinos
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "xxxxxxxxxxxxxxxxxxxx";
WidgetLED led1(V1);
WidgetLED led2(V2);
void setup()
{
Blynk.begin(auth, "1fcab4", "278864212");
// Default baud rate is 9600. You could specify it like this:
//Blynk.begin(auth, 57600);
pinMode(2, INPUT);
pinMode(3, INPUT);
// Attach INT to our handler
attachInterrupt(digitalPinToInterrupt(2), checkPin, CHANGE);
attachInterrupt(digitalPinToInterrupt(3), checkPin, CHANGE);
}
void checkPin()
{
if (digitalRead(2)) {
if (digitalRead(3))
led1.off();
led2.on();
} else {
led1.on();
led2.off();
}
}
void loop()
{
Blynk.run();
}
With the pins being different on the WeMos than the Uno, I would start there. Throw a few serial lines (like below), push the buttons and see if the serial monitor is showing those button pushes:
If you have your buttons on WeMos pins D2 and D3, you’d want your code to be pinMode(4, INPUT); pinMode(0, INPUT); (in lieu of pinMode(2, INPUT); pinMode(3, INPUT);)… and elsewhere in your code.
Thank you for your quick reply but am little confused i try everything you told me .Is it possible to make the changes to the code so i can use it with wemos d1 or send me an example? I know i am asking a lot:-)