Oving4_4
Dependencies: mbed
main.cpp@1:e3039b96e3e9, 2017-09-19 (annotated)
- Committer:
- olemh88
- Date:
- Tue Sep 19 12:44:13 2017 +0000
- Revision:
- 1:e3039b96e3e9
- Parent:
- 0:5071536b4cf6
?ving4_4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andreped | 0:5071536b4cf6 | 1 | #include "mbed.h" |
andreped | 0:5071536b4cf6 | 2 | |
andreped | 0:5071536b4cf6 | 3 | DigitalOut Led1(LED1); |
andreped | 0:5071536b4cf6 | 4 | DigitalOut Led2(LED2); |
andreped | 0:5071536b4cf6 | 5 | DigitalOut Led3(LED3); |
andreped | 0:5071536b4cf6 | 6 | DigitalOut Led4(LED4); |
andreped | 0:5071536b4cf6 | 7 | Ticker tick1; |
andreped | 0:5071536b4cf6 | 8 | Ticker tick2; |
andreped | 0:5071536b4cf6 | 9 | Ticker tick3; |
andreped | 0:5071536b4cf6 | 10 | Ticker tick4; |
olemh88 | 1:e3039b96e3e9 | 11 | volatile int xx, yy, zz, ee; |
andreped | 0:5071536b4cf6 | 12 | |
andreped | 0:5071536b4cf6 | 13 | void x() |
andreped | 0:5071536b4cf6 | 14 | { |
olemh88 | 1:e3039b96e3e9 | 15 | xx = !xx; |
andreped | 0:5071536b4cf6 | 16 | } |
andreped | 0:5071536b4cf6 | 17 | void y() |
andreped | 0:5071536b4cf6 | 18 | { |
olemh88 | 1:e3039b96e3e9 | 19 | yy = !yy; |
andreped | 0:5071536b4cf6 | 20 | } |
andreped | 0:5071536b4cf6 | 21 | void z() |
andreped | 0:5071536b4cf6 | 22 | { |
olemh88 | 1:e3039b96e3e9 | 23 | zz = !zz; |
andreped | 0:5071536b4cf6 | 24 | } |
andreped | 0:5071536b4cf6 | 25 | void e() |
andreped | 0:5071536b4cf6 | 26 | { |
olemh88 | 1:e3039b96e3e9 | 27 | ee = !ee; |
andreped | 0:5071536b4cf6 | 28 | } |
andreped | 0:5071536b4cf6 | 29 | int main() |
andreped | 0:5071536b4cf6 | 30 | { |
andreped | 0:5071536b4cf6 | 31 | tick1.attach(&x,1); |
andreped | 0:5071536b4cf6 | 32 | tick2.attach(&y, 0.3); |
andreped | 0:5071536b4cf6 | 33 | tick3.attach(&z, 0.14); |
andreped | 0:5071536b4cf6 | 34 | tick4.attach(&e, 0.1); |
andreped | 0:5071536b4cf6 | 35 | while(1) { |
olemh88 | 1:e3039b96e3e9 | 36 | Led1 = xx; |
olemh88 | 1:e3039b96e3e9 | 37 | Led2 = yy; |
olemh88 | 1:e3039b96e3e9 | 38 | Led3 = zz; |
olemh88 | 1:e3039b96e3e9 | 39 | Led4 = ee; |
andreped | 0:5071536b4cf6 | 40 | |
andreped | 0:5071536b4cf6 | 41 | } |
andreped | 0:5071536b4cf6 | 42 | } |