arduino:basic_interaction
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
arduino:basic_interaction [2012/09/13 05:45] – mithat | arduino:basic_interaction [2012/09/13 05:47] – mithat | ||
---|---|---|---|
Line 9: | Line 9: | ||
Of the two, polling is probably easier to get started with. Following is a simple example of using polling. | Of the two, polling is probably easier to get started with. Following is a simple example of using polling. | ||
- | ===== Switch controlled LED ===== | + | ===== Switch-controlled LED ===== |
- | This example uses polling to determine the state of a switch. If the switch is pressed, Arduino will turn an LED on. If it is not pressed, it will turn off. | + | This example uses polling to determine the state of a switch. If the switch is pressed, Arduino will turn an LED on. If it is not pressed, it will turn the LED off. |
<file c LightSwitch.ino> | <file c LightSwitch.ino> | ||
Line 25: | Line 25: | ||
void setup() { | void setup() { | ||
- | pinMode(pushButtonPin, | + | pinMode(pushButtonPin, |
- | pinMode(ledPin, | + | pinMode(ledPin, |
} | } | ||
Line 58: | Line 58: | ||
void setup() { | void setup() { | ||
- | pinMode(pushButtonPin, | + | pinMode(pushButtonPin, |
- | pinMode(ledPin, | + | pinMode(ledPin, |
} | } | ||
Line 83: | Line 83: | ||
void setup() { | void setup() { | ||
- | pinMode(pushButtonPin, | + | pinMode(pushButtonPin, |
- | pinMode(ledPin, | + | pinMode(ledPin, |
} | } | ||
arduino/basic_interaction.txt · Last modified: 2012/09/14 01:19 by mithat