Introduction
Connect a Thumbstick to a Bit Board and control a set of LEDs connected via Maker Tape.
Video Overview
Featured Document
-
-
We'll connect the Thumbstick with a Crazy Circuits Ribbon Cable using all four wires.
-
Plug the three-wire connector of the Crazy Circuits Ribbon Cable into the row with Pin 0 on the Bit Board. The wire colors should match the pin header colors, with S1 (yellow) going to the yellow pin.
-
Next, plug S2 (orange) into Pin 13. (S2 is separated from the three-wire connector to allow you to plug it into another row.)
-
To the Thumbstick plug - (black) into GND, + (red) into +5V; S1 (yellow) into VRx; S2 (orange) into SW.
-
We won't plug anything into VRy pin for this example.
-
-
-
We used a 3D printed part we designed to hold the Thumbstick in place on a LEGO baseplate.
-
We attached two 2x4 LEGO Bricks to the bottom of the 3D printed holder to allow it to snap onto the LEGO Baseplate a bit easier. (We also added a few small bricks to hold the ribbon cable in place.)
-
Alternately you can try to use some LEGO bricks and some rubber bands to hold the sensor in place, or just hold it in your hand.
-
3D print your own Thumbstick Sensor Holder.
-
-
-
If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use
-
We're going to load the following code for our Thumbstick LEDs Signals List program: https://makecode.microbit.org/_VHVDHkFVy...
-
In the on start block we'll disable the LED matrix, set Pin 13 to pull up, and then create two lists containing two different sets of digital pins.
-
In one forever loop we'll read the value of Pin 13, assigning it to buttonVal, and then set blState to either 1 or 0.
-
In a related forever block we'll check to see if blState and blStatePrev are different, and if so, set the LEDs to the value of blState, which will be 1 or 0. And finally, we'll set blStatePrev to the value of blState.
-
In the third forever loop we'll set xVal to the value from Pin 0 and then check if the Thumbstick is pressed all the way to the left or all the way to the right, and call the appropriate function.
-
The functions (signalLeft and signalRight) will display a short 3 pixel animation using the LEDs. We pass in the length of the pause we want after each step of the animation.
-
The functions both do the same thing, but in slightly different ways.
-
-
-
Once the code is loaded it should start running immediately.
-
You can power the micro:bit via the USB cable you used to load the code or you can use a battery pack plugged into the Bit Board.
-
Move the Thumbstick left and right and you should see two different "turn signal" animations, one for each direction.
-
Press the button and the down motion will turn on the LEDs while the up motion will turn off the LEDs.
-
-
-
Follow along with our recorded Live Stream!
-
(We'll add the video to this step after we do the stream!)
-
