Advertisement
safwan092

Untitled

Dec 1st, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <SPI.h>
  2. #include <Wire.h>
  3. #include <Adafruit_GFX.h>
  4. #include <Adafruit_SSD1306.h>
  5. #include<SoftwareSerial.h>
  6. SoftwareSerial lora(3, 2);
  7.  
  8. #define OLED_RESET 4
  9. Adafruit_SSD1306 display(OLED_RESET);
  10.  
  11.  
  12. void setup()
  13. {
  14. Serial.begin(9600);
  15. lora.begin(9600);
  16. display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  17. display.clearDisplay();
  18. display.setTextSize(2);
  19. display.setTextColor(WHITE);
  20. display.setCursor(20, 10);
  21. display.println("R:");
  22. display.display();
  23. }
  24.  
  25. void loop()
  26. {
  27. if (lora.available() > 0) {
  28. display.clearDisplay();
  29. String input = lora.readStringUntil('\n');
  30. Serial.print("R: ");
  31. Serial.println(input);
  32. display.setTextSize(2);
  33. display.setTextColor(WHITE);
  34. display.setCursor(20, 10);
  35. display.print("R:");
  36. display.println(input);
  37. display.display();
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement