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:44] – [Switch controlled LED] mithat | arduino:basic_interaction [2012/09/13 05:46] – mithat | ||
---|---|---|---|
Line 20: | Line 20: | ||
// connect the push button to digital pin 2 | // connect the push button to digital pin 2 | ||
- | int pushButton | + | int pushButtonPin |
// connect the LED to pin 13 | // connect the LED to pin 13 | ||
int ledPin = 13; | int ledPin = 13; | ||
void setup() { | void setup() { | ||
- | pinMode(pushButton, INPUT); | + | pinMode(pushButtonPin, INPUT); |
- | pinMode(ledPin, | + | pinMode(ledPin, |
} | } | ||
void loop() { | void loop() { | ||
- | int buttonState = digitalRead(pushButton); // read the input pin | + | int buttonState = digitalRead(pushButtonPin); // read the input pin |
// set LED state accordingly | // set LED state accordingly | ||
Line 53: | Line 53: | ||
// connect the push button to digital pin 2 | // connect the push button to digital pin 2 | ||
- | int pushButton | + | int pushButtonPin |
// connect the LED to pin 13 | // connect the LED to pin 13 | ||
int ledPin = 13; | int ledPin = 13; | ||
void setup() { | void setup() { | ||
- | pinMode(pushButton, INPUT); | + | pinMode(pushButtonPin, INPUT); |
- | pinMode(ledPin, | + | pinMode(ledPin, |
} | } | ||
void loop() { | void loop() { | ||
- | int buttonState = digitalRead(pushButton); // read the input pin | + | int buttonState = digitalRead(pushButtonPin); // read the input pin |
digitalWrite(ledPin, | digitalWrite(ledPin, | ||
// | // | ||
Line 78: | Line 78: | ||
// connect the push button to digital pin 2 | // connect the push button to digital pin 2 | ||
- | int pushButton | + | int pushButtonPin |
// connect the LED to pin 13 | // connect the LED to pin 13 | ||
int ledPin = 13; | int ledPin = 13; | ||
void setup() { | void setup() { | ||
- | pinMode(pushButton, INPUT); | + | pinMode(pushButtonPin, INPUT); |
- | pinMode(ledPin, | + | pinMode(ledPin, |
} | } | ||
void loop() { | void loop() { | ||
- | digitalWrite(ledPin, | + | digitalWrite(ledPin, |
// | // | ||
} | } | ||
</ | </ |
arduino/basic_interaction.txt · Last modified: 2012/09/14 01:19 by mithat