Asento tunnistin Tilt switch with led matrix images
Revision 0:174c437ba62b, committed 2018-08-17
- Comitter:
- tyynetyyne
- Date:
- Fri Aug 17 13:33:43 2018 +0000
- Commit message:
- Tilt switch with led matrix images;
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 174c437ba62b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Aug 17 13:33:43 2018 +0000 @@ -0,0 +1,25 @@ + +#include "MicroBit.h" + +MicroBit uBit; +MicroBitImage STOP("255,255,255\n255,255,255\n255,255,255\n"); +MicroBitImage PLAY("255,0,0\n255,255,0\n255,255,255\n255,255,0\n255,0,0\n"); +int asento = 0; + +int main(){ + uBit.init(); + while (1){ + asento = uBit.io.P0.getDigitalValue(); + MicroBitImage image(5,5); + if(asento == 1){ + image.paste(PLAY, 1, 0); + uBit.display.print(image); + uBit.sleep(1000); + } else { + image.paste(STOP, 1, 1); + uBit.display.print(image); + uBit.sleep(1000); + } + } +} +
diff -r 000000000000 -r 174c437ba62b microbit.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/microbit.lib Fri Aug 17 13:33:43 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/Lancaster-University/code/microbit/#4b89e7e3494f