This is a souped up version of the basic mbed blinky, as a 2nd stepping stone up from the basic blinky and also because the documentation doesn't seem to really be that complete.

Dependencies:   mbed

Fork of mbed_quadBlinky by Jason Tay

Files at this revision

API Documentation at this revision

Comitter:
shutay
Date:
Tue Oct 03 16:53:41 2017 +0000
Child:
1:f4e48249b980
Commit message:
Souped up version of the basic blinky.

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 03 16:53:41 2017 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+void initialise()
+{
+    // Baud rate not required over USB.
+    led1 = 1;
+    led2 = 1;
+    led3 = 1;
+    led4 = 1;
+    wait(1.0f);
+    //*==========================================*
+    // Do initialisation here
+    //*==========================================*
+    
+    //*==========================================*
+    led1 = 0;
+    led2 = 0;
+    led3 = 0;
+    led4 = 0;
+    wait(1.0f);
+}
+
+void updateLEDs(int val)
+{
+    led1 = val & 0x01;
+    led2 = (val & 0x02) >> 1;
+    led3 = (val & 0x04) >> 2;
+    led4 = (val & 0x08) >> 3;
+}
+
+void advanceLEDs(int *val)
+{
+    *val = *val << 1;
+    if(*val>0x08) *val = 1;
+}
+
+int main()
+{
+    initialise();
+    
+    int i = 1;
+    while(1)
+    {
+        updateLEDs(i);
+        advanceLEDs(&i);
+        wait(0.5f);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 03 16:53:41 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/235179ab3f27
\ No newline at end of file