forked from https://developer.mbed.org/users/hardtail/code/MATSU-bed_blinky/
Fork of MATSU-bed_blinky by
main.cpp@2:f94af4a543bd, 2016-05-18 (annotated)
- Committer:
- Tiryoh
- Date:
- Wed May 18 13:46:00 2016 +0000
- Revision:
- 2:f94af4a543bd
- Parent:
- 1:68364bcdd696
Fix blink error; ; ?????????????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hardtail | 0:d696cd1aea56 | 1 | #include "mbed.h" |
hardtail | 1:68364bcdd696 | 2 | #include "USBSerial.h" |
hardtail | 0:d696cd1aea56 | 3 | |
hardtail | 0:d696cd1aea56 | 4 | #define LED1 P0_29 |
hardtail | 0:d696cd1aea56 | 5 | #define LED2 P0_28 |
hardtail | 0:d696cd1aea56 | 6 | #define LED3 P0_27 |
hardtail | 0:d696cd1aea56 | 7 | #define LED4 P0_26 |
hardtail | 0:d696cd1aea56 | 8 | |
hardtail | 0:d696cd1aea56 | 9 | #define ISP0 P0_4 |
hardtail | 0:d696cd1aea56 | 10 | #define ISP1 P0_16 |
hardtail | 0:d696cd1aea56 | 11 | |
hardtail | 0:d696cd1aea56 | 12 | //USBSerial pc; |
hardtail | 0:d696cd1aea56 | 13 | |
hardtail | 1:68364bcdd696 | 14 | BusOut myled(LED1, LED2, LED3, LED4); |
hardtail | 0:d696cd1aea56 | 15 | |
hardtail | 0:d696cd1aea56 | 16 | //DigitalIn sw1(ISP0); |
hardtail | 0:d696cd1aea56 | 17 | //DigitalIn sw2(ISP1); |
hardtail | 0:d696cd1aea56 | 18 | |
hardtail | 0:d696cd1aea56 | 19 | int main() { |
hardtail | 0:d696cd1aea56 | 20 | //sw1.mode(PullUp); |
hardtail | 0:d696cd1aea56 | 21 | |
Tiryoh | 2:f94af4a543bd | 22 | myled = 0b0001; |
hardtail | 0:d696cd1aea56 | 23 | |
hardtail | 0:d696cd1aea56 | 24 | while(1){ |
hardtail | 0:d696cd1aea56 | 25 | if(myled < 0b1000){ |
Tiryoh | 2:f94af4a543bd | 26 | wait(0.5); |
hardtail | 0:d696cd1aea56 | 27 | myled = myled << 1; |
hardtail | 0:d696cd1aea56 | 28 | }else{ |
Tiryoh | 2:f94af4a543bd | 29 | while(myled != 0b0001) { |
Tiryoh | 2:f94af4a543bd | 30 | wait(0.5); |
Tiryoh | 2:f94af4a543bd | 31 | myled = myled >> 1; |
Tiryoh | 2:f94af4a543bd | 32 | } |
hardtail | 0:d696cd1aea56 | 33 | } |
hardtail | 0:d696cd1aea56 | 34 | } |
Tiryoh | 2:f94af4a543bd | 35 | } |