![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Lejla Agić Pajić Enil
main.cpp@0:87b90179fb7d, 2014-03-10 (annotated)
- Committer:
- tim008
- Date:
- Mon Mar 10 08:11:05 2014 +0000
- Revision:
- 0:87b90179fb7d
LV2-G1-Tim008-Z2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim008 | 0:87b90179fb7d | 1 | #include "mbed.h" |
tim008 | 0:87b90179fb7d | 2 | |
tim008 | 0:87b90179fb7d | 3 | BusOut l (dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); |
tim008 | 0:87b90179fb7d | 4 | DigitalOut e (dp14); |
tim008 | 0:87b90179fb7d | 5 | DigitalIn t1 (dp1); |
tim008 | 0:87b90179fb7d | 6 | DigitalIn t2 (dp2); |
tim008 | 0:87b90179fb7d | 7 | |
tim008 | 0:87b90179fb7d | 8 | int main() { |
tim008 | 0:87b90179fb7d | 9 | e = 0; |
tim008 | 0:87b90179fb7d | 10 | int x = 0; |
tim008 | 0:87b90179fb7d | 11 | bool p = false; |
tim008 | 0:87b90179fb7d | 12 | l = x; |
tim008 | 0:87b90179fb7d | 13 | while(1) { |
tim008 | 0:87b90179fb7d | 14 | l = (x + 1) % 256; |
tim008 | 0:87b90179fb7d | 15 | wait (0.15); |
tim008 | 0:87b90179fb7d | 16 | if (!p) |
tim008 | 0:87b90179fb7d | 17 | { |
tim008 | 0:87b90179fb7d | 18 | p = true; |
tim008 | 0:87b90179fb7d | 19 | if (t1 == 1) x++; |
tim008 | 0:87b90179fb7d | 20 | else if (t2 == 1) x--; |
tim008 | 0:87b90179fb7d | 21 | } |
tim008 | 0:87b90179fb7d | 22 | if (t1 == 0 && t2 == 0) p = false; |
tim008 | 0:87b90179fb7d | 23 | } |
tim008 | 0:87b90179fb7d | 24 | } |