ESP8266 and Arduino connected by SPI interface


#21

Hi, you really need to make a debug output. As I wrote you in my previous post, make sure you are getting correct values in the in variable. You have to add some Serial.print() in your function.


#22

Hi,

After adding Serial.println() before “else” statement, this is the debug output when i press the button on thinger dashboard :

[_SOCKET] Connecting to [my_server_domain]
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Connected!
[THINGER] Authenticating. User: ****** Device: ********
[THINGER] Writing bytes: 52 [OK]
[THINGER] Authenticated
[THINGER] Available bytes: 25
[THINGER] Writing bytes: 8 [OK]

[THINGER] Writing bytes: 15 [OK]
[THINGER] Available bytes: 86
[THINGER] Writing bytes: 8 [OK]
[THINGER] Available bytes: 58
[THINGER] Writing bytes: 7 [OK]
[THINGER] Available bytes: 30
[THINGER] Writing bytes: 8 [OK]
[THINGER] Available bytes: 19
[THINGER] Writing bytes: 4 [OK]

[THINGER] Writing bytes: 15 [OK]
[THINGER] Available bytes: 19
[THINGER] Writing bytes: 4 [OK]

[THINGER] Writing bytes: 15 [OK]
[THINGER] Available bytes: 19
[THINGER] Writing bytes: 4 [OK]

[THINGER] Writing bytes: 15 [OK]
[THINGER] Available bytes: 19
[THINGER] Writing bytes: 4 [OK]

[THINGER] Writing bytes: 15 [OK]
[THINGER] Available bytes: 19
[THINGER] Writing bytes: 4 [OK]

[THINGER] Writing bytes: 15 [OK]
[THINGER] Available bytes: 19
[THINGER] Writing bytes: 4 [OK]

FYI, i am using my own VPS for the platform.


#23

First, when you add debug printouts, you have to print something unique and useful, not only newline. Any unique text would do.
Second, if the newlines got printed out after you pressed the button and the app should have run the else statement, then something is wrong. Maybe the variable in is always empty. You definitely have to find this out via another debug printout.


#24

Actually, there is exactly same result for the code of “thing[“Machine_Start”]<< digitalPin(6);”.
That code is straight to the point for boolean On & Off.
Another hardware that i am using is only NodeMCU for both main controller & wifi controller, and also executing the same function like this :

thing[“Machine_On”]<< [](pson& in) {
if(in.is_empty()){
in=(bool)digitalRead(5);
}else{
digitalWrite(5, in ? LOW : HIGH); //Here is the control of the GPIO5
digitalWrite(machine_on, HIGH); // Get start
delay(100); // sending delay 100ms
digitalWrite(machine_on, LOW); // Get low
}
};

The result is good, output pin is high for 100ms then going low. Works perfect.
My point is, there is nothing wrong with “in” variable, because another hardware that have direct connection to WiFi prove that this is okay.


#25

Hi @Andrei_Sousa,

What is the progress of this experiment? Did you experience any strange result using WiFiEspIsp?