Hello r/arduino,
I have recently discovered the wonderful world of the Arduino with modules, and I want to create a cryptocurrency ticker that retrieves prices from the Internet, onto the ESP-8266 (the one pictured here), then on the Arduino, and finally on a 20x4 LCD that I have.
So, I was trying to learn how to move a variable Y from the ESP to the Arduino, and then having the Arduino to output the code onto my LCD.
The wiring part is something I believe I have correct. I just hooked up the TX of the ESP to the RX of the Arduino, the RX of the ESP to the TX of the Arduino, the 3V3 pin of the ESP to the 3.3V pin of the Arduino, and Ground to Ground.
For programming, I just hook up my ESP to the PC using its microUSB port, since it has one:
Here is the code from the ESP-8266:
#include <ESP8266WiFi.h>
//ESP-8266 Test Code
int y = 1337;
void setup() {
Serial.begin(115200);
}
void loop() {
delay(500);
Serial.write(y);
}
And here is the code from the Arduino Uno:
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int y = 0;
void setup() {
lcd.begin(20, 4);
Serial.begin(115200);
}
void loop() {
if (Serial.available() > 0) {
y = Serial.read();
Serial.print("I received: ");
Serial.println(y);
lcd.setCursor(0, 0);
lcd.println(y);
Serial.print(y);
}
delay(500);
}
When I do run the code, the Arduino’s LCD output is 57, while the 2 character squares after 57 on the LCD are lit up, but the even-numbered lines on them are not lit up. The serial output on the Arduino is “I received: 57” repeatedly, as you would expect.
The LCD works fine since I tried some other example code and it worked correctly.
So my question is, what have I forgotten here? What am I doing wrong? I googled for quite a few hours, and I didn’t get anywhere. The if statement was pulled directly from Arduino’s example code on the serial page they have.
If you need any other info, just reply here asking for info.
Thank you for reading until here, and you would be doing me a solid if you can help me fix my code!
Have a nice day!