Thank you for seeing my post.
I am trying to write a code that lets "A" displayed on row 1 and row 0 alternately on the LCD. starting from (0,1) then (1,0) then (2,1), then (3,0) etc.. when it reaches the last point is becomes "B" and bouncing back the other way until reaching the starting point when it becomes "A" again and repeat again..
I wrote this code but I got stuck at the end, I don't know how to bounce it back:
// include the library code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the library with the numbers of the interface pins
int x = 0;
int y = 1;
void setup()
{
lcd.begin(16, 2);
lcd.clear();
}
void loop()
{
{
{
while (x < 15)
{
lcd.setCursor(x, y);
lcd.print("A");
delay(250);
lcd.clear();
x = x + 1;
lcd.setCursor(x, y - 1);
lcd.print("A");
delay(250);
lcd.clear();
x + x++;
}
}
{
while (x = 15)
lcd.setCursor(15, 0);
lcd.print("B");
delay(2000);
x--;
}
}
}
for
loop. It's much easier. And don't confuse assignment (=
) with comparison (==
) operators.