Toshiaki Kurokawa
/
Kairo_practice1_led_and_serial_for_nucleo
回路講習第2回用プログラム
main.cpp@0:6ab419decf1c, 2021-05-30 (annotated)
- Committer:
- momidi
- Date:
- Sun May 30 03:43:15 2021 +0000
- Revision:
- 0:6ab419decf1c
- Child:
- 1:0cbc07037f22
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
momidi | 0:6ab419decf1c | 1 | #include "mbed.h" |
momidi | 0:6ab419decf1c | 2 | |
momidi | 0:6ab419decf1c | 3 | DigitalOut led[]= {LED1,LED2,LED3}; |
momidi | 0:6ab419decf1c | 4 | Serial pc(USBTX, USBRX); |
momidi | 0:6ab419decf1c | 5 | |
momidi | 0:6ab419decf1c | 6 | int main() |
momidi | 0:6ab419decf1c | 7 | { |
momidi | 0:6ab419decf1c | 8 | while(1) { |
momidi | 0:6ab419decf1c | 9 | for(int i=0; i<3; i++) { |
momidi | 0:6ab419decf1c | 10 | led[i]=1; |
momidi | 0:6ab419decf1c | 11 | pc.printf("LED%d is ON\r\n",i+1); |
momidi | 0:6ab419decf1c | 12 | wait(1); |
momidi | 0:6ab419decf1c | 13 | led[i]=0; |
momidi | 0:6ab419decf1c | 14 | wait(1); |
momidi | 0:6ab419decf1c | 15 | } |
momidi | 0:6ab419decf1c | 16 | } |
momidi | 0:6ab419decf1c | 17 | } |