
Q3 instrumentations
Revision 0:0bffeecce43e, committed 2020-08-16
- Comitter:
- liammchale
- Date:
- Sun Aug 16 17:23:14 2020 +0000
- Commit message:
- Q3 instrumentations
Changed in this revision
diff -r 000000000000 -r 0bffeecce43e C12832.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Sun Aug 16 17:23:14 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/askksa12543/code/C12832/#990d5eec2ef6
diff -r 000000000000 -r 0bffeecce43e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Aug 16 17:23:14 2020 +0000 @@ -0,0 +1,40 @@ +//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); + } + } +} \ No newline at end of file
diff -r 000000000000 -r 0bffeecce43e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Aug 16 17:23:14 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file