From: Dobrica Pavlinusic Date: Fri, 26 Jun 2015 13:36:10 +0000 (+0200) Subject: display changing A0 values X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=inline;h=6a00113d3ec61d3ffeeb774f361e691d94287b47;p=Arduino display changing A0 values --- diff --git a/LCD_Keypad_Shield/LCD_Keypad_Shield.ino b/LCD_Keypad_Shield/LCD_Keypad_Shield.ino index 75cd611..31857d5 100644 --- a/LCD_Keypad_Shield/LCD_Keypad_Shield.ino +++ b/LCD_Keypad_Shield/LCD_Keypad_Shield.ino @@ -15,6 +15,7 @@ char msgs[5][15] = {"Right Key OK ", int adc_key_val[5] ={30, 150, 360, 535, 760 }; int NUM_KEYS = 5; int adc_key_in; +int old_adc = 0; int key=-1; int oldkey=-1; @@ -34,6 +35,10 @@ void setup() { void loop() { adc_key_in = analogRead(0); // read the value from the sensor + + if (old_adc != adc_key_in) + Serial.println(old_adc = adc_key_in); + digitalWrite(13, HIGH); key = get_key(adc_key_in); // convert into key press