Download presentation
Presentation is loading. Please wait.
1
Digital Input from Switches
2
DISCLAIMER & USAGE The content of this presentation is for informational purposes only and is intended for students attending Louisiana Tech University only. The authors of this information do not make any claims as to the validity or accuracy of the information or methods presented. Any procedures demonstrated here are potentially dangerous and could result in damage and injury. Louisiana Tech University, its officers, employees, agents and volunteers, are not liable or responsible for any injuries, illness, damage or losses which may result from your using the materials or ideas, or from your performing the experiments or procedures depicted in this presentation. The Living with the Lab logos should remain attached to each slide, and the work should be attributed to Louisiana Tech University. If you do not agree, then please do not view this content. boosting application-focused learning through student ownership of learning platforms
3
Arduino Arduino Wiring the Switch switch not pressed ANALOG DIGITAL
RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER Arduino 10kW ANALOG RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER Arduino 10kW switch pressed
4
Arduino Why the 10kΩ Resistor?
Using a large resistance limits the current so that we don’t waste electricity! ANALOG RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER Arduino 10kW switch 𝑃=𝑉∙𝐼= 𝑉 2 𝑅 = 5𝑉 ,000Ω =0.0025W=2.5mW . . . any resistor will do, but there’s no sense in wasting power
5
(direct connection to power)
Use a Digital Input to Sense When Switch is Pressed ANALOG RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER Arduino 10kW switch digitalRead(7) check status of pin 7 using . . . void setup(){ pinMode(7,INPUT); Serial.begin(9600); } void loop(){ Serial.print(digitalRead(7)); switch status voltage at pin 7 status of digital input 7 open (not pressed) 0V (no power applied) LOW or 0 closed (pressed) 5V (direct connection to power) HIGH or 1
6
Run Power Wires to Breadboard Bus Strips
cut and strip jumper wires to connect the second bus strip to the first one red to 5V black to GND red wire to + black wire to - Clean Wiring is Good! twisted red & black wires from your kit
7
Arduino Wire a Switch and Enter the Sketch to See if it Works! NO COM
These three wires are connected COM prong from switch NO prong from switch ANALOG RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER Arduino 10kW switch void setup(){ pinMode(7,INPUT); Serial.begin(9600); } void loop(){ Serial.println(digitalRead(7)); COM NO
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.