Liam McHale
/
Q3inst
Q3 instrumentations
main.cpp
- Committer:
- liammchale
- Date:
- 2020-08-16
- Revision:
- 0:0bffeecce43e
File content as of revision 0:0bffeecce43e:
//debounce and interrupt experiment //pre processor directives #include "mbed.h" #include "C12832.h" //global declarations C12832 lcd(p5,p7,p6,p8,p11); InterruptIn joystickcenter (p14); InterruptIn Button (p9); DigitalOut led(LED1); DigitalOut flash(LED4); int x; //variable for flip function Timer debounce; void flip(){ debounce.start(); if(debounce.read_ms ()>200){ //only toggles after 200ms led = !led; x = 1; lcd.printf( "debounce value is %d\n\r",debounce.read_ms()); debounce.reset(); } } int main(){ lcd.cls(); lcd.locate(0,0); joystickcenter.rise(&flip); Button.mode(PullUp); Button.rise(&flip); while(1){ flash = !flash; if(x==1) { lcd.printf("variable is set %d \n\r",led.read()); x = 0; wait(0.25); } } }