The snap:bit is an electronic component for the Snap Circuits educational electronic kit. It features a socket for connecting the BBC micro:bit. This allows the Snap Circuits to be programmatically controlled by the micro:bit.
This project demonstrates how to properly connect the Red LED (D1) component from Snap Circuits to the snap:bit board and light it up using the micro:bit.
This would work with any other LED components from the Snap Circuits kits.
Snap Circuits diagramBuild the circuit shown in the diagram above.
CodeThe code for this project is very simple. It just writes a digital 1 signal to pin P1 when the micro:bit starts.
You can build the code yourself in the MakeCode Editor. You will find the "digital write pin" block under the Advanced > Pins section.
Alternatively, open the ready project here: https://makecode.microbit.org/_C99Jkd42b1pc
Once ready, download the code to your micro:bit. Then disconnect all cables from your micro:bit. Both the USB and the battery pack must be disconnected from the micro:bit.
How it works...When you close the slide switch (S1), the Battery Holder (B1) powers the snap:bit through the 3V snap and the micro:bit turns on. The “on start” event triggers and the micro:bit writes a digital 1 signal to pin P1. This lets the current flow through the LED (D1), which turns it on, and back through the GND of the snap:bit and the battery.
The positive (+) end of an LED can be connected to any of the 0, 1 and 2 snaps of the snap:bit. The negative (-) end of the LED must always be connected to the GND pin of the snap:bit.
Note that the P0, P1 and P2 pins of the micro:bit have a built-in resistor, so it is safe to connect the LED without any additional resistor. If connecting the LED to the 3V snap, you still need to include a resistor like the 100Ω Resistor (R1).
Minimal LED connectionYou can connect the LED directly across the 1 and GND snaps on top of the snap:bit without any additional wires.
This minimal setup is very useful when experimenting with the code and the micro:bit is connected to the computer. This way you can have just the snap:bit with the LED next to your computer without any additional components.
Comments
Please log in or sign up to comment.