Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:b1b7f136054e, committed 2017-02-28
- Comitter:
- RyotaNakamura
- Date:
- Tue Feb 28 11:24:20 2017 +0000
- Commit message:
- ???????LED??
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r b1b7f136054e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Feb 28 11:24:20 2017 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +BusOut myleds(LED1, LED2, LED3, LED4); //BusOutライブラリ利用 +Serial pc(USBTX, USBRX); + +void isrRx(){ //受信割込みハンドラ + char ch; + ch = pc.getc(); //受信 + + switch(ch){ + case '1': //1のキー入力 + myleds=1; //LED1点灯(2^0はLED1) + break; + case '2': //2のキー入力 + myleds=2; //LED2点灯(2^1はLED2) + break; + case '3': //3のキー入力 + myleds=4; //LED3点灯(2^2はLED3) + break; + case '4': //4のキー入力 + myleds=8; //LED4点灯(2^3はLED4) + break; + } +} + +int main(){ + pc.baud(9600); //クロックレート設定 + pc.printf("Let`s input on a keyboard between 1 and 4!!\n"); + + while(1) { + pc.attach(isrRx,Serial::RxIrq); //割込み + wait(0.1); + } +} + \ No newline at end of file
diff -r 000000000000 -r b1b7f136054e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 28 11:24:20 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f \ No newline at end of file