My goal is to send a string "Hello World" from the ESP8266 to the Arduino Leonardo. What would the code look like on both the receiver and sender sides? I know that the Leonardo has two Serial ports Serial and Serial1. Also, because I only want to send data one way (esp tx to leonardo rx) do I still need a voltage divider? I believe my ESP is on 3.3v while the Leonardo is 5.5v.
Heres a diagram. Pretend the arduino on the bottom is an ESP8266.
Yes, it's possible to connect the 3.3V ESP8266 output to the 5V arduino input on the Arduino Leonardo without damaging either board, but not the other way around (5V->3.3V).
Personally however, I'd still use a level shifter, just in case I got the boards' Tx and Rx accidentally mixed up. I use an I2C level-shifter like this:
My goal is to send a string "Hello World" from the ESP8266 to the Arduino Leonardo. What would the code look like on both the receiver and sender sides? I know that the Leonardo has two Serial ports Serial and Serial1. Also, because I only want to send data one way (esp tx to leonardo rx) do I still need a voltage divider? I believe my ESP is on 3.3v while the Leonardo is 5.5v.
You don’t want a voltage divider from a Tx at 3.3V sending data to an Rx expecting a HIGH at 5V… ideally you would need to boost the signal but usually 3.3V is seen as HIGH on the UART. Don’t forget to join the GNDs.