s

Dependencies:   mbed mbed

Revision:
0:1f2bac0f6ab8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Aug 28 09:31:55 2018 +0000
@@ -0,0 +1,74 @@
+#include "mbed.h"
+#include "Serial.h"
+
+/*送信*/
+/*
+Serial usbSerial(PA_9, PA_10);
+ 
+void ISR_Serial_Rx()
+{
+    // シリアルの受信処理
+    char data = usbSerial.getc();
+}
+ 
+void ISR_Serial_Tx()
+{
+    // シリアルのs送信処理
+    usbSerial.attach(NULL, Serial::TxIrq);
+}
+ 
+int main()
+{
+    // シリアル通信の速度設定
+    usbSerial.baud(9600);
+ 
+    // シリアル通信受信の割り込みイベント登録
+    usbSerial.attach(ISR_Serial_Rx, Serial::RxIrq);
+ 
+    // シリアル通信のデータ送信
+    usbSerial.attach(ISR_Serial_Tx, Serial::TxIrq);
+
+    
+ 
+    while (1) {
+        // メイン処理
+        usbSerial.putc('2');
+        wait(3.0);
+        printf("a\r\n");
+    }
+}
+*/
+
+
+/*受信*/
+
+Serial usbSerial(PA_9,PA_10);
+Serial MySerial1(USBTX,USBRX);
+ 
+void ISR_Serial_Rx()
+{
+    // シリアルの受信処理
+    char data = usbSerial.getc();
+    
+    printf("%c",data);
+    printf("Hello world!\r\n");
+    
+    
+}
+ 
+int main()
+{
+    // シリアル通信の速度設定
+    usbSerial.baud(9600);
+ 
+    // シリアル通信受信の割り込みイベント登録
+    usbSerial.attach(ISR_Serial_Rx, Serial::RxIrq);
+ 
+    while (1) { 
+        // メイン処理
+        printf("NOKOLAT\r\n");
+        wait(1.0);
+ 
+        }
+    
+}