Hold1

From ArduinoInfo
Jump to navigation Jump to search
-------------------------------------
Let's look at this picture:

external image Yourduino-Inputs1.jpg

external image Yourduino-Inputs1.jpg


YOU connect INPUT DEVICES that switch INPUTS to HIGH or LOW (1 or 0). Arduino can now tell what is happening with your INPUT DEVICES.

ARDUINO switches OUTPUTS to HIGH or LOW (1 or 0) to control the OUTPUT DEVICES that you connect.

Think about that:

  • The INPUT DEVICES you wire up (like switches, thermostats, motion sensors) switch INPUTS to HIGH or LOW (1 or 0)
  • ARDUINO switches OUTPUTS to HIGH or LOW (1 or 0) to activate your OUTPUT DEVICES.

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

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 Reed Switch (Magnet switch) , a Tilt Sensor, a Motion Sensor or many other devices like 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

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:

From the Starter Set:

  • Big Pushbutton (Switch)
  • Reed Switch ( magnetic switch )
  • Tilt sensor (mercury switch)
  • Motion Sensor (electronic Infrared Sensor: Powered)

Other Input Devices:

  • 11
  • 22


[list]

A FEW SIMPLE ON-OFF OUTPUT DEVICES:

Here are just a few of many Output Devices that you can connect to Arduino:

From the Starter Set:

    • Electronic buzzer/beeper module [Digital Output]
    • LED module (White) [Digital Output]

Here are j