Gerardo Carmona
/
MSE_BusOut
BusOut example
main.cpp@0:14e600ce8429, 2014-11-20 (annotated)
- Committer:
- gcarmonar
- Date:
- Thu Nov 20 21:01:24 2014 +0000
- Revision:
- 0:14e600ce8429
BusOut example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gcarmonar | 0:14e600ce8429 | 1 | #include "mbed.h" |
gcarmonar | 0:14e600ce8429 | 2 | |
gcarmonar | 0:14e600ce8429 | 3 | |
gcarmonar | 0:14e600ce8429 | 4 | BusOut leds(LED1, D9, LED2, LED3); |
gcarmonar | 0:14e600ce8429 | 5 | |
gcarmonar | 0:14e600ce8429 | 6 | int x = 1; |
gcarmonar | 0:14e600ce8429 | 7 | |
gcarmonar | 0:14e600ce8429 | 8 | int main() |
gcarmonar | 0:14e600ce8429 | 9 | { |
gcarmonar | 0:14e600ce8429 | 10 | leds = 1; |
gcarmonar | 0:14e600ce8429 | 11 | while (true) { |
gcarmonar | 0:14e600ce8429 | 12 | leds = x; |
gcarmonar | 0:14e600ce8429 | 13 | x = x << 1; |
gcarmonar | 0:14e600ce8429 | 14 | if (x == 16){ |
gcarmonar | 0:14e600ce8429 | 15 | x = 1; |
gcarmonar | 0:14e600ce8429 | 16 | } |
gcarmonar | 0:14e600ce8429 | 17 | printf("%d\n", x); |
gcarmonar | 0:14e600ce8429 | 18 | wait(1); |
gcarmonar | 0:14e600ce8429 | 19 | } |
gcarmonar | 0:14e600ce8429 | 20 | } |