From: Hans Åge Martinsen Date: Mon, 29 Aug 2011 20:16:18 +0000 (+0200) Subject: Changed for HIGH to LOW logic, and enabled internal pullups for the UI-buttons X-Git-Url: https://git.defcon.no/?a=commitdiff_plain;h=4c9cb26f8cbc42abe39a841544e7fb30bc3e18cd;p=rctxduino Changed for HIGH to LOW logic, and enabled internal pullups for the UI-buttons --- diff --git a/source/RCTXDuino/RCTXDuino.pde b/source/RCTXDuino/RCTXDuino.pde index 134526e..652a52c 100644 --- a/source/RCTXDuino/RCTXDuino.pde +++ b/source/RCTXDuino/RCTXDuino.pde @@ -153,6 +153,7 @@ void setup(){ // In reality they are tri-purpose; ADC, Digital, Digital Interrupts // Unfortunately the interrupt mode is unusable in this scenario, but digital I/O works :P pinMode(A2, INPUT); + digitalWrite(A2, HIGH); // Debugging: how long does the main loop take on avg... t = micros(); @@ -226,7 +227,7 @@ void set_timer(long time) boolean check_key( int key) { - return ( keys[key] && !prev_keys[key] ); + return ( !keys[key] && prev_keys[key] ); } void mplx_select(int pin) @@ -460,11 +461,11 @@ void dr_value() lcd.print( model.dr[pos] ); - if ( keys[KEY_INC] ) { + if ( !keys[KEY_INC] ) { if ( model.dr[pos] < 100) model.dr[pos] += 5; return; } - else if ( keys[KEY_DEC] ) { + else if ( !keys[KEY_DEC] ) { if ( model.dr[pos] > -100) model.dr[pos] -= 5; return; } @@ -748,4 +749,4 @@ void ui_handler() - +