Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
  4. LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
  5.  
  6. String val;
  7. int valInt;
  8.  
  9. void setup() {
  10. Serial.begin(9600);
  11. lcd.begin(16, 2);
  12.  
  13. }
  14.  
  15. void loop() {
  16.  
  17. while (!Serial.available());
  18. {
  19. lcd.clear();
  20. lcd.setCursor(0, 0);
  21. val = Serial.readString();
  22. String valAscii;
  23. Serial.flush();
  24. for (int i = 0; i < sizeof(val); i++) {
  25.  
  26. int valAscii = val.charAt(i);
  27.  
  28. Serial.print(valAscii);
  29. Serial.print(" ");
  30.  
  31. //delay(1000);
  32. }
  33. Serial.print("\n");
  34. lcd.print(val);
  35.  
  36.  
  37.  
  38.  
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement