五力全開 / Mbed 2 deprecated Nucleo_printf

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Nthu_Five
Date:
Sat May 28 03:34:49 2016 +0000
Child:
1:f6e87237daaa
Commit message:
BT 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	Sat May 28 03:34:49 2016 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+//------------------------------------
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+ 
+DigitalOut myled(LED1);
+Serial bluetooth(D10, D2); // tx,rx
+
+int ReceiveCount = 0;
+char BluetoothDataReceived[21];
+int main() {
+  int i = 1;
+  pc.printf("Hello World !\n");
+  
+  bluetooth.baud(9600);
+  
+  while(1) { 
+  
+      if(bluetooth.readable())
+      {
+        unsigned char temp = bluetooth.getc() - 158;
+        pc.printf("%c",temp);
+        ReceiveCount++;
+        pc.printf("  count: %d   ",ReceiveCount);
+        //pc.printf("%c",bluetooth.getc());
+      }
+      //pc.printf("This program runs since %d seconds.\n", i++);
+      myled = !myled;
+      //bluetooth.printf("\n Hi");
+      
+      /*
+    if(bluetooth.readable() >= 21)
+    {
+        //unsigned char temp = bluetooth.getc();
+        for(int i=0;i<21;i++)
+        {
+            BluetoothDataReceived[i] = bluetooth.getc();
+            pc.printf("%c",BluetoothDataReceived[i]);
+        }
+    }
+    */
+  }
+}
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 28 03:34:49 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file