micro:bit kolme lediä liikennevaloina (punainen=P2, keltainen=P1, vihreä=P0) three leds as traffic lights (red=P2, yellow=P1, green=P0)
Diff: main.cpp
- Revision:
- 0:1be186a0b596
--- /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); + } +}