Ultizin

Grupo 3 | Projeto 2

Apr 24th, 2025
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. //Bibliotecas
  2. #include <LiquidCrystal.h>
  3.  
  4. //Portas
  5. LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
  6.  
  7. //Voids
  8.  
  9. //Setup
  10. void setup() {
  11.     Serial.begin(9600);
  12.         lcd.begin(2, 16);
  13.     lcd.clear();
  14.         lcd.setCursor(0, 0);
  15.             lcd.print("Envie sua");
  16.         lcd.setCursor(0, 1);
  17.     lcd.print("mensagem...");
  18.  
  19. }
  20.  
  21. //Loop
  22. void loop() {
  23.     if (Serial.available()) {
  24.         char cr = Serial.read();
  25.  
  26.     if (cr == '%') {
  27.         lcd.clear();
  28.            
  29.         }
  30.            
  31.     else if (cr == '>') {
  32.         lcd.setCursor(0, 1);
  33.            
  34.         }
  35.            
  36.     else {
  37.         lcd.write(cr);
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment