Asento tunnistin Tilt switch with led matrix images
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 00002 #include "MicroBit.h" 00003 00004 MicroBit uBit; 00005 MicroBitImage STOP("255,255,255\n255,255,255\n255,255,255\n"); 00006 MicroBitImage PLAY("255,0,0\n255,255,0\n255,255,255\n255,255,0\n255,0,0\n"); 00007 int asento = 0; 00008 00009 int main(){ 00010 uBit.init(); 00011 while (1){ 00012 asento = uBit.io.P0.getDigitalValue(); 00013 MicroBitImage image(5,5); 00014 if(asento == 1){ 00015 image.paste(PLAY, 1, 0); 00016 uBit.display.print(image); 00017 uBit.sleep(1000); 00018 } else { 00019 image.paste(STOP, 1, 1); 00020 uBit.display.print(image); 00021 uBit.sleep(1000); 00022 } 00023 } 00024 } 00025
Generated on Wed Jul 13 2022 02:14:45 by 1.7.2