test

Files at this revision

API Documentation at this revision

Comitter:
David Yu
Date:
Fri Oct 06 13:30:32 2017 +0800
Parent:
0:5ec2204f1886
Commit message:
Revised baud rate

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5ec2204f1886 -r 94986ca0db0a main.cpp
--- a/main.cpp	Thu Oct 05 17:55:42 2017 +0000
+++ b/main.cpp	Fri Oct 06 13:30:32 2017 +0800
@@ -1,7 +1,7 @@
 // For NuMaker-PFM-NUC472 GPIO pins connected to rgbled, green led, buzzer
 #include "mbed.h"
 
-Serial pc(USBTX, USBRX); // tx, rx
+Serial device(PD_5, PD_4); // tx, rx
 DigitalOut    rgbled_B(PD_8); // low-active
 DigitalOut    rgbled_R(PD_9); // low-active
 DigitalOut    rgbled_G(PA_4); // low-active
@@ -10,6 +10,7 @@
 // (note the calls to Thread::wait below for d elays)
 int main() {
     rgbled_R=1;rgbled_G=1;rgbled_B=1;
+    device.baud(115200);
     while (true) {
                               rgbled_R=0;
                               rgbled_G=1;
@@ -22,7 +23,7 @@
                               rgbled_R=1;
                               rgbled_G=1;
                               rgbled_B=0;
-                              wait(1);                   
-                              pc.printf("Hello World!\n");
+                              wait(1);                  
+                              device.printf("Hello World!\n");
     }
 }