クイズ大会で使う早押しボタンのスパゲッティプログラムです。

Dependencies:   mbed

Committer:
771_8bit
Date:
Mon Sep 24 11:26:07 2018 +0000
Revision:
1:201290089367
Parent:
0:cb13f0c964c0
????????;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
771_8bit 0:cb13f0c964c0 1 #include "mbed.h"
771_8bit 0:cb13f0c964c0 2 #include "Serial.h"
771_8bit 1:201290089367 3
771_8bit 0:cb13f0c964c0 4 Serial usbSerial(USBTX, USBRX);
771_8bit 0:cb13f0c964c0 5 InterruptIn mybutton(USER_BUTTON,PullUp);
771_8bit 0:cb13f0c964c0 6
771_8bit 1:201290089367 7
771_8bit 0:cb13f0c964c0 8 void ISR_Serial_Rx()
771_8bit 0:cb13f0c964c0 9 {
771_8bit 0:cb13f0c964c0 10 // シリアルの受信処理
771_8bit 0:cb13f0c964c0 11 char data = usbSerial.getc();
771_8bit 0:cb13f0c964c0 12 }
771_8bit 1:201290089367 13
771_8bit 0:cb13f0c964c0 14 void ISR_Serial_Tx()
771_8bit 0:cb13f0c964c0 15 {
771_8bit 0:cb13f0c964c0 16 // シリアルのs送信処理
771_8bit 0:cb13f0c964c0 17 usbSerial.attach(NULL, Serial::TxIrq);
771_8bit 0:cb13f0c964c0 18 }
771_8bit 0:cb13f0c964c0 19
771_8bit 1:201290089367 20 void isr()
771_8bit 1:201290089367 21 {
771_8bit 1:201290089367 22 usbSerial.puts("b");
771_8bit 0:cb13f0c964c0 23 }
771_8bit 1:201290089367 24
771_8bit 0:cb13f0c964c0 25 int main()
771_8bit 0:cb13f0c964c0 26 {
771_8bit 0:cb13f0c964c0 27 mybutton.fall(&isr);
771_8bit 0:cb13f0c964c0 28 while (1) {}
771_8bit 0:cb13f0c964c0 29 }