In this activity we will begin investigating input devices to control functions on the Ardino. We will also learn about the Analog ports on the arduino as well as how the arduino can communicate with the host computer. Then we will use this knowledge to control LEDs with push buttons and use the Arduino as a Voltmeter.
Switches and Push Buttons
Logic Levels
Pullup Resistors
Serial Monitor
Arduino as a Voltmeter
if and else statements
Review the following Presentation:
Capture the results of your investigation in your engineering notebook:
3.7 - Buttons, Switches, and the Serial Monitor Part 1 (ENET) - lmsa
Login to your class TinkerCAD account. Your teacher will provide you with the link as well as a “nickname” with which you can login.
In TinkerCAD, follow along with the following 4 videos to learn about Switches, Pullup Resistors and the implications of both.
The Slideswitch is a simple SPDT switch. Watch and take notes on the video and use the TInkerCAD simulation to investigate how the slideswitch works. Then answer the questions below.
The Slideswitch is a simple SPDT switch. Watch and take notes on the video and use the TInkerCAD simulation to investigate how the slideswitch works. Then answer the questions below.
The Pushbutton Switch, sometimes referred to as a Momentary switch, is a simple SPsT switch, even though it has 4 leads. This is because the 1a and 1b and the 2a and 2b leads are shorted together in pairs. Watch and take notes on the video and use the TInkerCAD simulation to investigate how the pushbutton switch works.
Even though we often refer to digital signals a s1’s and 0’s, the truth is they are each an analog voltage that falls within a voltage range that represents 1 or 0. These are what are commonly referred to as logic levels. It should be noted that there is a voltage range between high and low that is indeterminate. To avoid circuits that have these undefined signals, engineers use pullup or pull down resistors. Watch and take notes on the video and use the TInkerCAD simulation to investigate how the pullup and pulldown resistors work.
Now that we have investigated the technology of the switch, pullup resistor and serial monitor, it is time to implement these technologies with the arduino. Follow along with the video to implement a serial monitor output from a pushbutton.
This section will build off of the 3-LED prototype built in the previous section. Two button switches will be added to the TinkerCAD simulation to control the illumination of the LEDs.
Follow along with the TinkerCAD tutorial to implement both the circuit and the code: (reference the activity Document for pictures of the circuit and code)
Now we will create the prototype of this simulation with switches and the circuit we built in the last section. Follow along with the video and build your prototype.
You have built a circuit that has 3 LEDs and 2 buttons. Currently the code controls each button individually. Your design challenge is to update the code to have the following performance:
If no buttons are pressed all LEDs are off
If the Left button is pressed the Green LED illuminates
If the Right button is pressed the Red LED illuminates
If the both buttons are pressed the Yellow LED illuminates
Here is a demonstration of the desired functionality of the circuit.