Step 4Testing Individual Components
This is surely the most critical step of this Instructable. You need to build a test circuit so you can understand how the components are hooked up and used with the Teensy. This step will also cover serial communication using the Teensy.
In the images you will see a breadboard which has the following components (left to right)
- Teensy++ microcontroller
- Two potentiometers
- One rotary encoder with pushbutton
- One mini LED
- Three mini pushbuttons
You may also notice my connections between the pushbuttons look a bit goofy (the one yellow wire). I did this for a reason. It shows that instead of connecting the pushbutton ground directly to the ground linked to the Teensy (blue strip) you can plug the ground from one pushbutton to the next, so long as one of the pushbuttons is linked to the Teensy ground. This is important cause when you are wiring your components into your panel the ground connection on the Teensy is usually not as convenient as the ground of the neighboring components. This is an excellent way to reduce the number of wires in your controllers. I also did the same thing for the potentiometers with the grey wires.
Usually LEDs should have resistors in series to prevent them from burning out over time. Since this was just a quick test I left the resistor out of the circuit. Also note that LEDs are polarized, meaning they have a power and ground end. If not hooked up correctly they with fail to light up or burn out.
Once you have the circuit hooked up, proceed to opening to code. Read the many comments within the code to help you understand what is going on.
Upload the code attached to your Teensy++ and launch the serial monitor. The serial monitor should give you feedback as you interact with the components: 'button 24 pressed', 'analog 2 value: 344', 'encoder +'. If your serial monitor is constantly spewing out values then you have hooked up something incorrectly. Make sure your serial monitor is running at 9600bps.
The LED is set to flash at different brightness levels depending on which pushbutton you click.
Before you move onto the next step, ensure this is working and you (without doubt) understand how to hook up each of these components to the Teensy++.
All code can be found here on GitHub. For this section use the code titled 'Testing Components'. Click 'ZIP' in the top-left to download.
| « Previous Step | Download PDFView All Steps | Next Step » |






























































i will fix that
SSG