#include <LiquidCrystal.h>
#include <Streaming.h>
LiquidCrystal lcd( 18, 11, 19, 20, 21, 22, 23 );
int status = 15;
int position = 8;
int mod = 0;
unsigned long prev = 0;
void setup( )
{
pinMode( status, OUTPUT );
digitalWrite( status, HIGH );
Serial.begin( 9600 );
}
void loop( ) {
int x, y;
x = analogRead( 6 );
y = analogRead( 7 );
Serial << x << " " << y << endl;
if( x>y ) mod = 1;
else if( x<y ) mod = -1;
else mod = 0;
if ( millis( ) - prev > ( 2200-x-y ) ) {
lcd.clear( );
prev = millis( );
position += mod;
if( position > 16 ) position = 0;
if( position < 0 ) position = 16;
lcd.setCursor( position, 1 );
lcd.print( "^" );
}
delay( 100 );
}