This function works best when the Calliope mini is using batteries for power, instead of the USB cable.
Find whether the pin you say is pressed or not pressed.
If you hold the GND
pin with one hand and touch pin 0
, 1
, or 2
with the other,
a very small (safe) amount of electricity will flow through your body and back into
the Calliope mini. This is called completing a circuit. It’s like you’re a big wire!
input.pinIsPressed(TouchPin.P0);
true
or false
)This program shows 1
if P0
is pressed, and 0
if P0
is not pressed:
basic.forever(() => {
if (input.pinIsPressed(TouchPin.P0)) {
basic.showNumber(1, 150)
} else {
basic.showNumber(0, 150)
}
})
Calliope mini pins, on pin pressed, analog read pin, analog write pin, digital read pin, digital write pin