miniblip serial demo

Dependencies:   USBDevice mbed

Fork of HelloWorld by Aerodyne

Files at this revision

API Documentation at this revision

Comitter:
pighixxx
Date:
Thu Nov 26 09:30:25 2015 +0000
Parent:
1:3a83283bcc1c
Commit message:
miniblip serial demo

Changed in this revision

HelloWorld.cpp Show diff for this revision Revisions of this file
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
diff -r 3a83283bcc1c -r 8a14f4d5079b HelloWorld.cpp
--- a/HelloWorld.cpp	Fri Jun 06 19:16:10 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#include "mbed.h"
-
-unsigned int counter = 0;   // Keep count of lifetime
-Serial pc(USBTX, USBRX);    // Talk to the computer
-
-void count() {
-    // Announce lifetime
-    pc.printf("I have been alive for %i seconds.\n", counter);
-    counter++;  // Count up by 1
-}
-
-int main() {
-    pc.printf("Hello world!\n");    // Say hello
-    while(true) {   // Main loop
-        count();    // Call our function
-        wait(1);    // Wait for 1 second
-    }               // Repeat
-}
\ No newline at end of file
diff -r 3a83283bcc1c -r 8a14f4d5079b USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Nov 26 09:30:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#2af474687369
diff -r 3a83283bcc1c -r 8a14f4d5079b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 26 09:30:25 2015 +0000
@@ -0,0 +1,24 @@
+// miniblip USB Serial
+
+#include "mbed.h"
+
+
+unsigned int counter = 0;   
+Serial pc(USBTX, USBRX);    
+
+void count() {
+    // Announce lifetime
+    pc.printf("mini blip is alive for %i seconds.\n", counter);
+    counter++;  
+}
+
+int main() {
+    // Turn off miniblip buzzer
+    PwmOut speaker(P0_8);
+    speaker=0.0;
+    pc.printf("Hello world!\n");    
+    while(true) {   //Main loop
+        count();    
+        wait(1);    
+    }               
+}
\ No newline at end of file