![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Øving 4.2 Arben og Adrian
Diff: main.cpp
- Revision:
- 1:31fe0557741c
- Parent:
- 0:0887fcb9e2eb
- Child:
- 2:e9d2e03e1b8c
diff -r 0887fcb9e2eb -r 31fe0557741c main.cpp --- a/main.cpp Wed Sep 20 12:55:16 2017 +0000 +++ b/main.cpp Wed Sep 20 13:07:59 2017 +0000 @@ -1,12 +1,20 @@ #include "mbed.h" - -PwmOut myled(LED1); -AnalogIn potmeter(p20); +Ticker Mytick; +BusOut teller(LED1, LED2, LED3, LED4); +volatile int Countup = 0; + +void myTickerFunc() +{ + Countup++; + if(Countup == 16) { + Countup = 0; + } +} int main() { - myled.period(0.02); + Mytick.attach(&myTickerFunc, 2.0); while(1) { - myled.write(potmeter); - wait (0.1); + teller = Countup; } } + \ No newline at end of file