Assignment 2c commit work

Dependencies:   MODSERIAL mbed

Fork of Minor_test_serial by First Last

Files at this revision

API Documentation at this revision

Comitter:
MarijkeZondag
Date:
Sun Sep 16 13:49:23 2018 +0000
Parent:
3:a3ad58758696
Child:
5:107eb09fb095
Commit message:
assignment 2c nu wel goed;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 11 15:06:12 2018 +0000
+++ b/main.cpp	Sun Sep 16 13:49:23 2018 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "MODSERIAL.h"
 
+DigitalOut gpo(D0);
 DigitalOut myled(LED_GREEN);
 MODSERIAL pc(USBTX, USBRX);
 DigitalIn button(PTA4);
@@ -9,16 +10,15 @@
 { 
     pc.baud(115200);
     pc.printf("Hello World!\r\n");
+    char c;
+    c = pc.getc();
+    pc.printf(" %c \n",c);
     
     while (true)
     {
-        myled==1;
-        
-        if (button==0) 
-        {
-            wait(0.5f); // wait a small period of time
-            pc.printf("%c \n",c);
-            myled = !myled; // toggle a led
-        }
+            gpo     = !gpo;
+            myled   = !myled; // toggle a led
+            wait (0.2f);
     }
 }
+