USB CDC CLASS MBED

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
franni
Date:
Wed Oct 10 02:40:15 2018 +0000
Commit message:
serial mbed cdc usb class

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
diff -r 000000000000 -r 6b657e23c254 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 10 02:40:15 2018 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+DigitalOut led_g(LED_GREEN);
+AnalogIn AN1(PTB0);
+
+Serial rs232(USBTX,USBRX);
+
+char c;
+float val_adc;
+
+void receivedByte()
+{
+    c = rs232.getc();
+    if(c=='h') {
+        led_g=1;
+    }
+    if(c=='l') {
+        led_g=0;
+    }
+}
+
+int main()
+{
+
+    rs232.baud(9600);
+    rs232.attach(&receivedByte);
+    while(true) {
+        val_adc=AN1;
+        rs232.printf("Valor Lectura ADC\r\n");
+        rs232.printf("%f \n\r",val_adc);
+        wait(0.1);
+    }
+}
+
+
diff -r 000000000000 -r 6b657e23c254 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 10 02:40:15 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file