One part of my project consist of looking at a buffer location and printing that number "1 2 3 or 4" (actual number in buffer) to a serial display which is working great. Now I am trying to incorporate my animation which scrolls the numbers left if going from "4 to 3, 3 to 2, 2 to 1" or scrolling right if going from "1 to 2, 2 to 3, 3 to 4" I am having trouble finding how I would write an "if" statement to do this.
The simple code below writes the gear to the display. When a gear is shifted an "a" or "G" will flash into the buffer between gears changes so I've stated to only serial.write the 1, 2, 3, or4. I'm not quite sure if the "a" or "G" will cause an issue in the If statement for the animation:
Serial1.write (MOVETO);
Serial1.write (END);
if ((buffer [ GEAR_POSITION ] == '1') ||
(buffer [ GEAR_POSITION ] == '2') ||
(buffer [ GEAR_POSITION ] == '3') ||
(buffer [ GEAR_POSITION ] == '4'))
{
Serial1.write(buffer[ GEAR_POSITION ]);
}
If it help to see the animation it is shown here - YouTube
I appreciate any help on this.