Asento tunnistin Tilt switch with led matrix images

Dependencies:   microbit

main.cpp

Committer:
tyynetyyne
Date:
2018-08-17
Revision:
0:174c437ba62b

File content as of revision 0:174c437ba62b:


#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);
                }
    }    
}