For this project, I wanted to be able to use a rocker on/off toggle switch to control an LED, and additionally connect an SD card so that in future projects I could modify the loop code to use the switch to read/write data to the SD card.
I had difficulty finding a good wiring diagram for this, so I've made one for you here with Fritzing!
The TWTADE rocker on/off switch (basic toggle switch) from Amazon comes attached to two wires already, so all you need to do is either strip off part of the insulation from the wires to be able to insert them fully into the breadboard, or otherwise solder typical male-male Arduino jumper wires to each wire end of the switch. Note that this is not a typical tactile button; it is a toggle switch that stays off when you toggle it off, and stays on when you toggle it on. In the Fritzing diagram I use a typical 3-pin on/off toggle switch, which you could alternatively use by soldering to the middle pin and one of the outer pins.
You are likely to run into initialization errors with your SD card, so make sure you format it properly to FAT16 before using it (you will likely need an SD card reader to connect it to your laptop to format it).
You are also likely to run into issues with the toggle switch and LED if you do not wire them correctly, or if you use the incorrect type of resistor (I got it to work with 1k Ohm resistor for the switch, and 220 Ohm resistor for the LED).
In the end, for this project, you will use a toggle switch to control an LED, and separately store some example data to a microSD card.
Comments
Please log in or sign up to comment.