I will try to describe this odd behavior as best as I can:
digitalWrite(5,HIGH | LOW) works until I start the app (android). Then it no longer changes the hardware pin state. A button in the app on GP5 always works. Stopping the app doesn’t fix it. Triggering with the GP5 button widget fixes it, until I stop/start the app (play button).
It seems to only affect GP5.
My setup:
Local server, v 23.0
Sparkfun Thing Dev board
Arduino IDE
Things I’ve tried
If I create a new android app, it works. If I clone my old app, it does not.
I have tested on two Sparkfun ESP8266 Thing Boards.
I have simplified code to just the LED(s)
Since this had been working for a while, I tried un-doing some things that have changed:
-downgraded Blynk Arduino lib
-downgraded ESP Arduino lib
-downgraded local server jar
-remove the GP5 button on the app (there’s no other GP5 widgets)
Question: Was there some kind of schema update that makes my app no longer valid? My app is pretty involved so I’d like a way to make this work without having to recreate it all.
Code:
#define DOOR_POWER_RELAY 5
#define MYLED 13
#define VIRTUAL_DOOR 1
char auth = “xxxxx”;
#define BLYNK_PRINT Serial
#define WIFI_SSID “myAP”
#define WIFI_PASS “pass”
#define BLYNK_HOST “myhost.com”
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <SoftwareSerial.h>
SimpleTimer timer;
int doorState = 0;
void door(){
if(doorState == 0){
Serial.println(“Door Power High”);
digitalWrite(DOOR_POWER_RELAY,HIGH);
digitalWrite(MYLED,HIGH);
doorState = 1;
}else{
Serial.println(“Door Power Low”);
digitalWrite(DOOR_POWER_RELAY,LOW);
digitalWrite(MYLED,LOW);
doorState = 0;
}
}
BLYNK_WRITE(VIRTUAL_DOOR){
door();
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println(“starting”);
pinMode(DOOR_POWER_RELAY,OUTPUT);
pinMode(MYLED,OUTPUT);
Serial.println(“Door Power Low”);
digitalWrite(DOOR_POWER_RELAY,LOW);
digitalWrite(MYLED,LOW);
Blynk.begin(auth,WIFI_SSID,WIFI_PASS,BLYNK_HOST);
timer.setInterval(5000,door);
}
void loop() {
// put your main code here, to run repeatedly:
timer.run();
Blynk.run();
}