Crickit Inputs such as Touch can sometimes lock up when using MakeCode with CircuitPlayground - we recommend using the alligator connection pads on the 'bare' CPX instead of the Crickit until this is fixed! Or you can use Arduino, CircuitPython, micro:bit, etc.
There are four capacitive touch pads you can use to detect human touch. They have big pads you can use to attach alligator clips to extend the pads' reach.
You can connect the other end of the alligator wires to fruit and make your own fruit-touch robot. Or move servo motors based on touch, it's all fun.
Touch is identical on the micro:bit version of Crickit.
You can read the value of the captouch pads from the MakeCode CRICKIT block group, block
crickit read touch. This will return a value that is the change in value, touched vs. not.
Example for Crickit plus Circuit Playground Express or Feather
The program below sets up Crickit capacitive touch on pads 1, 2, 3 and 4. It then loops forever - if you touch a pad, it lights a NeoPixel. Pressing Button A clears the NeoPixels.
You can set different actions: if a touch is detected, change the direction of a motor as just one example.
This guide was first published on May 16, 2018. It was last
updated on May 16, 2018.
This page (MakeCode Touch) was last updated on Nov 01, 2018.
Example for Crickit and micro:bit
If you touch the capacitive touch pads, the one NeoPixel on the Crickit will glow (pad 1), get broighter (pads 2 and 3) and go out (pad 4).