MATSU-bedのLチカ用サンプルプログラム
Dependencies: mbed MATSUbed USBDevice
Fork of MATSU-bed_blinky by
Wiki https://developer.mbed.org/teams/MATSU-bed/wiki/MATSU-bed-config
main.cpp@1:68364bcdd696, 2016-04-14 (annotated)
- Committer:
- hardtail
- Date:
- Thu Apr 14 06:54:49 2016 +0000
- Revision:
- 1:68364bcdd696
- Parent:
- 0:d696cd1aea56
- Child:
- 2:f94af4a543bd
MATSU-bed?L????????????
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 | |
hardtail | 0:d696cd1aea56 | 22 | myled = 1; |
hardtail | 0:d696cd1aea56 | 23 | |
hardtail | 0:d696cd1aea56 | 24 | while(1){ |
hardtail | 0:d696cd1aea56 | 25 | if(myled < 0b1000){ |
hardtail | 0:d696cd1aea56 | 26 | myled = myled << 1; |
hardtail | 0:d696cd1aea56 | 27 | }else{ |
hardtail | 0:d696cd1aea56 | 28 | myled = myled >> 1; |
hardtail | 0:d696cd1aea56 | 29 | } |
hardtail | 0:d696cd1aea56 | 30 | wait(0.5); |
hardtail | 0:d696cd1aea56 | 31 | } |
hardtail | 0:d696cd1aea56 | 32 | } |