pxt-calliope/docs/projects/love-meter.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR (#529)
* Accessibility changes
2017-09-07 13:42:08 -07:00

943 B

love meter

~avatar avatar

Use pins and your body to change the display!

~

Step 1

Use on pin pressed to show a random number when pin P0 is pressed (hold the GND pin with other hand):

input.onPinPressed(TouchPin.P0, () => {
    basic.showNumber(Math.random(11));
});

Step 2

Show a string when pin P1 is pressed:

input.onPinPressed(TouchPin.P0, () => {
    basic.showNumber(Math.random(11));
});
input.onPinPressed(TouchPin.P1, () => {
    basic.showString("LOVE?");
});

Step 3

Show a heart when pin P2 is pressed:

input.onPinPressed(TouchPin.P0, () => {
    basic.showNumber(Math.random(11));
});
input.onPinPressed(TouchPin.P1, () => {
    basic.showString("LOVE?");
});
input.onPinPressed(TouchPin.P2, () => {
    basic.showLeds(`
        . # # # .
        # # # # #
        # # # # #
        . # # # .
        . . # . .
        `);
});