Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ABuche
Date:
Sun Apr 15 16:16:56 2018 +0000
Commit message:
Initial commit;

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 f101b014b4a1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 15 16:16:56 2018 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+
+/*------------------------------------------------------------------------------
+Before to use this example, ensure that you an hyperterminal installed on your
+computer. More info here: https://developer.mbed.org/handbook/Terminals
+
+The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their
+definition in the PinNames.h file).
+
+The default serial configuration in this case is 9600 bauds, 8-bit data, no parity
+
+If you want to change the baudrate for example, you have to redeclare the
+serial object in your code:
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+Then, you can modify the baudrate and print like this:
+
+pc.baud(115200);
+pc.printf("Hello World !\n");
+------------------------------------------------------------------------------*/
+
+//Serial pc(PA_9, PA_10);
+
+Serial regis(PA_10, PA_11);
+
+DigitalOut led(LED1);
+DigitalOut led2(LED2);
+
+int main()
+{
+    const int bufferSize = 1024;
+    int * buffer = new int [bufferSize];
+    int i = 1;
+    char c = 'w';
+    //pc.printf("Hello World !\n");
+    led = 0;
+    led2= 0;
+    while(1) {
+        //pc.printf("This program runs since %d seconds.\r\n", i++);
+        c = regis.getc();
+        if (c == 'w'){
+            led = 1;
+        } else{
+            led2 = 1;
+        }
+        //pc.printf("Char: %c", c);
+        //if(regis.readable()){
+        //    pc.printf("Woooooow\r\n");
+        //}
+        i++;
+        if(i % 10 == 0){
+            led2 = !led2;
+        }
+    }
+}
diff -r 000000000000 -r f101b014b4a1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 15 16:16:56 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/994bdf8177cb
\ No newline at end of file