Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:35d45c4dd5d2, committed 2021-01-11
- Comitter:
- ajp109
- Date:
- Mon Jan 11 13:47:06 2021 +0000
- Parent:
- 2:f63cdb6f8a44
- Commit message:
- Initial commit
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file | 
diff -r f63cdb6f8a44 -r 35d45c4dd5d2 main.cpp
--- a/main.cpp	Tue Sep 29 09:55:47 2020 +0000
+++ b/main.cpp	Mon Jan 11 13:47:06 2021 +0000
@@ -3,26 +3,21 @@
 int main()
 {
     // Initialise the digital pins D2 and D3 as outputs
-    DigitalOut green(D2);
+    DigitalOut blue(D2);
     DigitalOut red(D3);
 
-    // Initialise the digital pins D4 and D5 as inputs with pullup resistors
-    DigitalIn PB1(D4, PullUp);
-    DigitalIn PB2(D5, PullUp);
+    // Initialise the digital pin USER_BUTTON (the blue button) as an input
+    DigitalIn button(USER_BUTTON);
     
     // Loop forever...
     while (true) {
-        // Is PB1 being pressed?
-        if (PB1 == false) {
-            // Light the red LED, extinguish the green
-            red = true;
-            green = false;
-        }
-        // Is PB2 being pressed?
-        if (PB2 == false) {
-            // Extinguish the red LED, light the green
-            red = false;
-            green = true;
-        }
+        
+        // Flash the blue LED: on for 100ms, off for 300ms
+        // Your code modifications should be made here
+        blue = true;
+        thread_sleep_for(100);
+        blue = false;
+        thread_sleep_for(300);
+        
     }
 }