test

Dependencies:   USBDevice mbed

Fork of USBSerial_HelloWorld by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
zapta
Date:
Mon Dec 21 07:12:39 2015 +0000
Parent:
9:d88699a0905a
Commit message:
.

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
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
diff -r d88699a0905a -r aed18128d16d USBDevice.lib
--- a/USBDevice.lib	Fri Mar 01 13:33:02 2013 +0000
+++ b/USBDevice.lib	Mon Dec 21 07:12:39 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
+http://mbed.org/users/mbed_official/code/USBDevice/#2af474687369
diff -r d88699a0905a -r aed18128d16d main.cpp
--- a/main.cpp	Fri Mar 01 13:33:02 2013 +0000
+++ b/main.cpp	Mon Dec 21 07:12:39 2015 +0000
@@ -1,14 +1,34 @@
 #include "mbed.h"
 #include "USBSerial.h"
  
-//Virtual serial port over USB
-USBSerial serial;
- 
-int main(void) {
+DigitalOut led(P0_20);  // LED pin
  
-    while(1)
-    {
-        serial.printf("I am a virtual serial port\r\n");
-        wait(1);
-    }
-}
\ No newline at end of file
+//Virtual serial port over USB
+USBSerial usb_serial;
+
+// Hardware serial to wifi device.
+Serial wifi_serial(P0_19, P0_18);  // tx, rx
+
+Timer timer;
+
+void setup() {
+  timer.start();
+  wifi_serial.baud(19200);
+}
+
+void loop() {
+  if (timer.read_ms() < 200) {
+      return;
+  }
+  led = !led;    // Invert LED state
+  timer.reset();
+  usb_serial.printf("usb\r\n");
+  wifi_serial.printf("wifi\r\n");
+}
+
+int main(void) {
+  setup();
+  for(;;) {
+    loop();
+  }
+}
diff -r d88699a0905a -r aed18128d16d mbed.bld
--- a/mbed.bld	Fri Mar 01 13:33:02 2013 +0000
+++ b/mbed.bld	Mon Dec 21 07:12:39 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file