Hi, i wanted to do serial communication between arduino uno and nodemcu. The temperature data from arduino successfully sent to nodemcu. the data can be display on nodemcu serial monitor. but, i want to display it on OLED display. is it possible? because i have tried it. the coding didnt work. can anyone check on my coding what i have done wrong?
#include <SoftwareSerial.h>
SoftwareSerial NodeMCU(D2, D3); //RX, ,TX
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); //Declaring the display name (display)
#define BUZZER D4 // LED for showing interrupt
void setup() {
Serial.begin(115200);
NodeMCU.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.print("Receiving data...");
display.display();
delay(200);
}
void loop()
{
while (NodeMCU.available() > 0) {
float data = NodeMCU.parseFloat();
if (NodeMCU.read() == '*') {
Serial.println(data);
display.setTextColor(WHITE);
display.setTextSize(4);
display.setCursor(20, 0);
display.print(data);
display.display();
delay(200);
}
}
delay(100);
}
here is my coding.
Did your simple "hello world" display test sketch work as expected?
yes!
wait did you mean on the oled display or serial monitor?
The OLED.
Is Software serial working OK at 115200?
No. i have tried with a simple sketch. it still does not display on the OLED.
Check out Arduino to Arduino via Serial for a complete example from Mega2560 hardware serial to ESP8266, For uno you need to either use the D0/D1 hardware serial or a SoftwareSerial (9600 baud suggest)
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.