TestColors

From ArduinoInfo
Jump to navigation Jump to search

THIS IS THE MAIN TITLE...


Here's some stuff:


  • ONE'
  • TWO
  • THREE


external image Yourduino-Inputs4.jpg


EVERYTHING IS ABOUT SWITCHING :
Let's look at this picture:
external image Yourduino-Inputs1.jpg
YOU switch INPUTS to HIGH or LOW (1 or 0)
ARDUINO switches OUTPUTS to HIGH or LOW (1 or 0)
Think about that:

  • The things YOU wire up (like switches, thermostats, light sensors) switch INPUTS to HIGH or LOW (1 or 0)
  • ARDUINO switches OUTPUTS to HIGH or LOW (1 or 0)

BUT: How does Arduino KNOW when to switch outputs? YOU tell it by writing software called "Sketches".
WAYS OF INPUT SWITCHING:
OK, Let's look at hooking up switches. We have some choices.
Because most switches just make a connection between two terminals, the usual way of connecting switches to INPUTS is to use a resistor to "Pull" the input HIGH or LOW, and then have the Switch "Pull" the input the other way when it is pushed (or the thermostat clicks, etc etc). Look at this picture:
external image Yourduino-Inputs2.jpg
Here, a resistor (Little Resistor-Speak details) is use to "pull the input LOW" so Arduino sees it as a 0 (zero). The switch is connected from HIGH to the INPUT and when it switches, it "pulls the input HIGH" and Arduino sees it as 1.
The "switch" can be a pushbutton, a Thermostat, a Pressure Switch, an Air Flow Sensor, and Window or Door Switch, etc etc.
[Let's hook up our Arduino to a switch now, like in the picture, and run some software that tells us what Arduino is "seeing" when the switch is pushed..]
But it's easy to simply reverse the location of the resistor and switch. Look at the picture below. Now, the resistor "pulls the Input HIGH" and the switch "pulls the Input LOW" and Arduino sees that as 0 (zero).
external image Yourduino-Inputs3.jpg
(box) It's easy to just "Fix" anything that seems "upside down" by either re-arranging the circuit, or simply tell Arduino (in the software Sketch you write) to look for a 0 instead of a 1. Remember: "Fix It In Software"..
A FEW SWITCH-TYPE INPUT DEVICES:
Here are just a few of many Input Devices that act as switches, that you can connect to Arduino:
[list]
A FEW SENSORS AS INPUT DEVICES:
Let's look at a simple light sensor (Below). Hook up a "Light Dependent Resistor" and a regular fixed resistor as shown here. In room light the "LDR" is a low resistanceand so it "pulls the input HIGH". In the dark it is high resistance and the fixed resistor "pulls the Input LOW. This is fine, when the change of light is large, as when room lights are turned on and off, etc