User Tools

Site Tools


arduino:arduino_crash_course:digital_input

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
arduino:arduino_crash_course:digital_input [2017/11/06 02:38] – [Digital Input] mithatarduino:arduino_crash_course:digital_input [2017/12/06 01:13] (current) – [Digital Input] mithat
Line 3: Line 3:
 The Arduino literature refers to "digital" inputs, and while this is strictly accurate, a better name for these kinds of inputs is "Boolean" or "logical" inputs. However, we will use the more common "digital input" to avoid confusion. The Arduino literature refers to "digital" inputs, and while this is strictly accurate, a better name for these kinds of inputs is "Boolean" or "logical" inputs. However, we will use the more common "digital input" to avoid confusion.
  
-An Arduino digital input is one that responds to two different levelsanything above a certain voltage (but lower than the Arduino's supply voltage) is considered HIGH, and anything below a certain voltage (but not below 0 volts) is considered LOW. Anything in between is not defined. The threshold levels will vary with specific Arduino implementation, so to learn what they are you should consult the documentation.+An Arduino digital input is one that responds to two different levelsanything above a certain threshold is considered HIGH, and anything below a certain voltage is considered LOW. Anything in between is not defined. The threshold levels will vary with specific Arduino implementation, so to learn what they are you should consult the documentation.
  
 <WRAP center round important 60%> <WRAP center round important 60%>
Line 9: Line 9:
 </WRAP> </WRAP>
  
-Typically, digital input signals are designed so that when HIGH they have a value equal to the supply voltage and when LOW they are equal to 0 volts.+Digital output signals are typically designed so that when HIGH they have a value equal to the supply voltage and when LOW they are equal to 0 volts.
  
 We've already seen an example of Arduino digital inputs in the [[arduino:arduino_crash_course:basic_interaction|Basic Interaction]] examples. Here is the ''LightSwitchPullup2.ino'' example but using an additional variable type that better matches the role of the ''buttonState'' variable. Variables of type ''boolean'' can store the values ''true'' and ''false''. Since the button has two states, pushed and not pushed, using a variable that can store only two states, ''true'' and ''false'' makes sense. We have chosen to let ''true'' correspond to the button's "pushed" and ''false'' correspond to "not pushed." It is typical for variables used to store digital inputs be of type ''boolean''. We've already seen an example of Arduino digital inputs in the [[arduino:arduino_crash_course:basic_interaction|Basic Interaction]] examples. Here is the ''LightSwitchPullup2.ino'' example but using an additional variable type that better matches the role of the ''buttonState'' variable. Variables of type ''boolean'' can store the values ''true'' and ''false''. Since the button has two states, pushed and not pushed, using a variable that can store only two states, ''true'' and ''false'' makes sense. We have chosen to let ''true'' correspond to the button's "pushed" and ''false'' correspond to "not pushed." It is typical for variables used to store digital inputs be of type ''boolean''.
arduino/arduino_crash_course/digital_input.1509935936.txt.gz · Last modified: 2017/11/06 02:38 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki