test

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
sink
Date:
Fri Sep 25 05:01:04 2020 +0000
Commit message:
test

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 25 05:01:04 2020 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "string"
+#define INT_TIME 0.5
+
+Ticker timer;
+
+DigitalOut led(LED3);
+
+RawSerial pc (USBTX,USBRX,115200);
+RawSerial Slave (p9,p10,115200);
+
+string Slave_str = "";
+string pc_str = "";
+
+void Slave_recv(){
+    
+    char Slave_c = Slave.getc();
+    Slave_str += Slave_c;
+    
+    if(Slave_c == '\n'){
+        pc_str = Slave_str;
+        Slave_str = "";
+    }
+}
+
+void timer_warikomi(){
+    Slave.printf("Comm_Master\n");
+    pc.printf(pc_str.c_str());
+    led == !led;
+}
+
+int main(){
+    
+    timer.attach(&timer_warikomi,INT_TIME);
+    
+    Slave.attach(&Slave_recv,RawSerial::RxIrq);
+    
+    while(true){}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 25 05:01:04 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file