回路講習第2回用プログラム
Dependencies: mbed
Revision 1:0cbc07037f22, committed 2021-05-31
- Comitter:
- momidi
- Date:
- Mon May 31 06:27:41 2021 +0000
- Parent:
- 0:6ab419decf1c
- Commit message:
- test
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6ab419decf1c -r 0cbc07037f22 main.cpp --- a/main.cpp Sun May 30 03:43:15 2021 +0000 +++ b/main.cpp Mon May 31 06:27:41 2021 +0000 @@ -1,17 +1,16 @@ #include "mbed.h" - -DigitalOut led[]= {LED1,LED2,LED3}; +DigitalOut led(LED3); Serial pc(USBTX, USBRX); - int main() { while(1) { - for(int i=0; i<3; i++) { - led[i]=1; - pc.printf("LED%d is ON\r\n",i+1); - wait(1); - led[i]=0; - wait(1); + for(int i=1; i<4; i++) { + led=1; + pc.printf("LED%d is ON\r\n",3); + wait(i); + led=0; + pc.printf("LED%d is OFF\r\n",3); + wait(i); } } } \ No newline at end of file