arduino:arduino_crash_course:digital_input
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
arduino:arduino_crash_course:digital_input [2012/11/06 00:42] – mithat | arduino:arduino_crash_course:digital_input [2017/12/06 01:13] (current) – [Digital Input] mithat | ||
---|---|---|---|
Line 3: | Line 3: | ||
The Arduino literature refers to " | The Arduino literature refers to " | ||
- | An Arduino digital input is one that responds to two different levels; anything above a certain | + | An Arduino digital input is one that responds to two different levels: anything above a certain |
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
Line 9: | Line 9: | ||
</ | </ | ||
- | 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 |
- | We've already seen an example of Arduino digital inputs in the [[arduino: | + | We've already seen an example of Arduino digital inputs in the [[arduino: |
+ | |||
+ | We have also added the '' | ||
<file c LightSwitchPullup2a.ino> | <file c LightSwitchPullup2a.ino> | ||
Line 101: | Line 103: | ||
boolean lastButtonState = HIGH; // value of buttonState from previous loop iteration | boolean lastButtonState = HIGH; // value of buttonState from previous loop iteration | ||
boolean buttonState = HIGH; | boolean buttonState = HIGH; | ||
- | |||
- | /* boolean debounce(int pinNum, boolean lastState) { | ||
- | boolean nowState = digitalRead(pinNum); | ||
- | if (lastState != nowState) { | ||
- | delay(debounceTime); | ||
- | nowState = digitalRead(pinNum); | ||
- | } | ||
- | return nowState; | ||
- | } */ | ||
boolean debounce(int pinNum) { | boolean debounce(int pinNum) { | ||
Line 124: | Line 117: | ||
void loop() { | void loop() { | ||
- | // buttonState = debounce(pushButtonPin, | ||
buttonState = debounce(pushButtonPin); | buttonState = debounce(pushButtonPin); | ||
arduino/arduino_crash_course/digital_input.1352162560.txt.gz · Last modified: 2012/11/06 00:42 by mithat