Skip to content

Instantly share code, notes, and snippets.

@michaelsarduino
Created August 31, 2015 13:30
Show Gist options
  • Save michaelsarduino/6388fe5984f4a35ad06c to your computer and use it in GitHub Desktop.
Save michaelsarduino/6388fe5984f4a35ad06c to your computer and use it in GitHub Desktop.
void setup()
{
Serial.begin(9600);
}
void loop()
{
int button;
int status_A0 = analogRead(A0);
if(status_A0 < 10)
{
button = 0;
}
if(status_A0 > 925 && status_A0 < 935)
{
button = 1;
}
if(status_A0 > 970 && status_A0 < 980)
{
button = 2;
}
if(status_A0 > 1010 && status_A0 < 1017)
{
button = 3;
}
if(status_A0 > 1020 && status_A0 < 1030)
{
button = 4;
}
Serial.println(button);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment