hello
Dear, I am quite fresh in creating of app in MIT and I stopped on issue linked with update switch status in app after switching the LED on or off on Arduino.
I am using for communication HC05 and from my point of view everything should be ok but it is not.....
using below code I can receive from Arduino String but it is not possible to use it for button status changing.
I can see the text which I send from Arduino appear in texbox but when I put it to the function it is not working. please take a look below on MIT block and arduino code - maybe someone can catch point where I am making the mistake. thank you very much in advance for support in solving this problem
Arduino code:
#define button A3
int lastbuttonstate;
String bt;
void setup() {
Serial1.begin(9600);
pinMode(button, INPUT_PULLUP);
}
void loop() {
int reading = digitalRead(button);
if (reading != lastbuttonstate){
if(reading == 1){
bt = "on";
Serial1.println("off");
}
if(reading == 0){
bt = "off";
Serial1.println("on");
}
delay(100);
}
lastbuttonstate = reading;
}