Antropex

Arduino Scroll

Nov 6th, 2021 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1.  
  2. #include <Wire.h>
  3. #include <LiquidCrystal_I2C.h>
  4. // initialize the library by associating any needed LCD interface pin
  5. // with the arduino pin number it is connected to
  6.  
  7. LiquidCrystal_I2C lcd(0x27, 16, 2);
  8. int kek=0;
  9. int dlugosc, ile=0;
  10. String msg = "MILY DZIADZIO";
  11. void setup() {
  12. lcd.init();
  13. lcd.backlight();
  14. dlugosc = msg.length();
  15. /* lcd.setCursor(0, 0);
  16. lcd.print("DL:");
  17. lcd.print(dlugosc);
  18. delay(2000);
  19. lcd.clear();
  20.  
  21. lcd.setCursor(0, 0);
  22. lcd.print("Test:");
  23. lcd.print(msg[1]);
  24. delay(2000);
  25. lcd.clear();
  26. */
  27.  
  28. lcd.setCursor(16-dlugosc, 0);
  29. lcd.print(msg);
  30. lcd.setCursor(0, 1);
  31. delay(1000);
  32. ile= 17- dlugosc;
  33. for (int positionCounter = 0; positionCounter < ile; positionCounter++) {
  34. kek++;
  35. delay(500);
  36. lcd.scrollDisplayLeft();
  37.  
  38.  
  39. }
  40. for(int i=0; i<15; i++){
  41. kek++;
  42. if(i<dlugosc){
  43. lcd.setCursor(kek+14, 1);
  44. lcd.print(msg[i]);
  45. }
  46. delay(500);
  47. lcd.scrollDisplayLeft();
  48. }
  49.  
  50. for(int i=0; i<kek; i++){
  51. delay(500);
  52. lcd.scrollDisplayRight();
  53. }
  54. }
  55.  
  56. void loop() {
  57.  
  58. }
  59.  
Add Comment
Please, Sign In to add comment