I'm also struggling to do the following: I want to be able to send a High signal (3.3v) from an Arduino to the ESP8266 ESP-12E, and for the ESP8266 ESP-12E to publish it.
I can get the read a Low signal from ground as follows,
- Code: Select all | TOGGLE FULL SIZE
pinMode(SENSOR1, INPUT_PULLUP);
- Code: Select all | TOGGLE FULL SIZE
current1 = digitalRead(SENSOR1);
// return if the value hasn't changed
if(current1 == last1)
return;
int32_t value1 = (current1 == LOW ? 1 : 0);
// Now we can publish stuff!
Serial.print(F("\nSending sensor1 value: "));
Serial.print(value1);
Serial.print("... ");
if (! sensor1.publish(value1))
Serial.println(F("Failed."));
else
Serial.println(F("Success!"));
// save the button state
last1 = current1;
How can I read a signal from my arduino?