Skip to content

Instantly share code, notes, and snippets.

@yamato8
Created February 11, 2014 23:26
Show Gist options
  • Save yamato8/8946560 to your computer and use it in GitHub Desktop.
Save yamato8/8946560 to your computer and use it in GitHub Desktop.
シリアル通信:割り込み:mbed
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led4(LED4);
Serial pc(USBTX, USBRX); // tx:送信, rx:受信
void rxCallback()
{
led4 = !led4;
pc.putc(pc.getc());
}
int main()
{
pc.attach(rxCallback, Serial::RxIrq);
while (1) {
led1 = !led1;
wait(0.5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment