Arben Nikqi
/
oving44
Øving 4.4
Diff: main.cpp
- Revision:
- 0:60ad536c1c05
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 20 13:13:31 2017 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" + +DigitalOut myLed1(LED1); +DigitalOut myLed2(LED2); +DigitalOut myLed3(LED3); +DigitalOut myLed4(LED4); +Ticker tick1; +Ticker tick2; +Ticker tick3; +Ticker tick4; +volatile int xx, yy, zz, ee; + +void x() +{ + xx = !xx; +} +void y() +{ + yy = !yy; +} +void z() +{ + zz = !zz; +} +void e() +{ + ee = !ee; +} +int main() +{ + tick1.attach(&x,1); + tick2.attach(&y, 0.3); + tick3.attach(&z, 0.14); + tick4.attach(&e, 0.1); + while(1) { + myLed1 = xx; + myLed2 = yy; + myLed3 = zz; + myLed4 = ee; + + } +} + +