micro:bit kolme lediä liikennevaloina (punainen=P2, keltainen=P1, vihreä=P0) three leds as traffic lights (red=P2, yellow=P1, green=P0)

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
tyynetyyne
Date:
Thu May 24 08:22:07 2018 +0000
Commit message:
traffic lights

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
microbit.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 1be186a0b596 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 24 08:22:07 2018 +0000
@@ -0,0 +1,19 @@
+#include "MicroBit.h"
+
+MicroBit uBit;
+
+int main()
+{
+    uBit.init();     
+    while (1){
+        uBit.io.P2.setDigitalValue(1);
+        uBit.sleep(4000);
+        uBit.io.P1.setDigitalValue(1);
+        uBit.sleep(2000);
+        uBit.io.P2.setDigitalValue(0);
+        uBit.io.P1.setDigitalValue(0);
+        uBit.io.P0.setDigitalValue(1);
+        uBit.sleep(4000);
+        uBit.io.P0.setDigitalValue(0);
+        }
+}
diff -r 000000000000 -r 1be186a0b596 microbit.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/microbit.lib	Thu May 24 08:22:07 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Lancaster-University/code/microbit/#4b89e7e3494f