Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. int buttonPin = 0;
  2. int buttonValue = 0;
  3.  
  4. void setup() {
  5.   Serial.begin(9600);
  6.   Serial.println("Ready.");
  7. }
  8.  
  9. void loop() {
  10.   buttonValue = analogRead(buttonPin);
  11.   if (buttonValue > 700) {
  12.     Serial.print('1');
  13.     while (buttonValue > 700) {
  14.       buttonValue = analogRead(buttonPin);
  15.     }
  16.   }
  17.   else if (buttonValue > 500) {
  18.     Serial.print('2');  
  19.     while (buttonValue > 500) {
  20.       buttonValue = analogRead(buttonPin);
  21.     }  
  22.   }
  23.   else if (buttonValue > 300) {
  24.     Serial.print('3');
  25.     while (buttonValue > 300) {
  26.       buttonValue = analogRead(buttonPin);
  27.     }
  28.   }
  29.   else if (buttonValue > 100) {
  30.     Serial.print('4').
  31.     while (buttonValue > 100) {
  32.       buttonValue = analogRead(buttonPin);
  33.     }
  34.   }
  35.   delay(25);
  36. }