#define potXPin A0
#define potYPin A1
#define pbPin 3
int pbValue = 0;
int potXVal=0, potYVal=0;
void setup ()
{
pinMode (pbPin , INPUT);
Serial.begin (9600);
}
void loop ()
{
potXVal= analogRead (potXPin );
potYVal= analogRead (potYPin );
pbValue = digitalRead (pbPin );
Serial.print("X = ");
Serial.println (potXVal);
Serial.print ("Y = ");
Serial.println (potYVal);
Serial.print("Button is ");
if (pbValue == HIGH){
Serial.println ("not pressed");
}
else{
Serial.println ("PRESSED");
}
delay (500);
}
Comments