First version of a led light house

Dependencies:   microbit

Committer:
tyynetyyne
Date:
Mon Jul 23 13:56:11 2018 +0000
Revision:
0:c78396b3c6b3
first version of ledimajakka;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tyynetyyne 0:c78396b3c6b3 1
tyynetyyne 0:c78396b3c6b3 2 #include "MicroBit.h"
tyynetyyne 0:c78396b3c6b3 3
tyynetyyne 0:c78396b3c6b3 4 MicroBit uBit;
tyynetyyne 0:c78396b3c6b3 5 int arvo = 0;
tyynetyyne 0:c78396b3c6b3 6
tyynetyyne 0:c78396b3c6b3 7 int main()
tyynetyyne 0:c78396b3c6b3 8 {
tyynetyyne 0:c78396b3c6b3 9 uBit.init();
tyynetyyne 0:c78396b3c6b3 10 while (1)
tyynetyyne 0:c78396b3c6b3 11 {
tyynetyyne 0:c78396b3c6b3 12 arvo = uBit.io.P1.getAnalogValue();
tyynetyyne 0:c78396b3c6b3 13 if(arvo <= 550)
tyynetyyne 0:c78396b3c6b3 14 {
tyynetyyne 0:c78396b3c6b3 15 uBit.io.P0.setDigitalValue(0);
tyynetyyne 0:c78396b3c6b3 16 }
tyynetyyne 0:c78396b3c6b3 17 else
tyynetyyne 0:c78396b3c6b3 18 {
tyynetyyne 0:c78396b3c6b3 19 uBit.io.P0.setDigitalValue(1);
tyynetyyne 0:c78396b3c6b3 20 uBit.sleep(1000);
tyynetyyne 0:c78396b3c6b3 21 uBit.io.P0.setDigitalValue(0);
tyynetyyne 0:c78396b3c6b3 22 uBit.sleep(1000);
tyynetyyne 0:c78396b3c6b3 23 }
tyynetyyne 0:c78396b3c6b3 24 }
tyynetyyne 0:c78396b3c6b3 25 }
tyynetyyne 0:c78396b3c6b3 26
tyynetyyne 0:c78396b3c6b3 27