Advertisement
ChaOSzz

Arduino_LCD_ino

Feb 20th, 2022
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal_I2C.h>
  2. LiquidCrystal_I2C lcd(0x27,16,2);
  3. int row = 0;
  4.  
  5. void setup() {
  6.   // put your setup code here, to run once:
  7.   lcd.init();
  8.   lcd.backlight();
  9.   lcd.cursor();
  10. }
  11.  
  12. void loop() {
  13.   // put your main code here, to run repeatedly:
  14.   for(int i = 0; i<16; i++)
  15.   {
  16.     if(digitalRead(2) == 1)
  17.     {
  18.       row = 1;
  19.     }else{
  20.       row = 0;
  21.     }
  22.     func(i,row);
  23.   }
  24. }
  25.  
  26.  
  27. void func(int i, int row)
  28. {
  29.     lcd.setCursor(i,row);
  30.     lcd.print("*");
  31.     delay(400);
  32.     lcd.clear();
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement