Arduino Uno; For More Information - Parallax 27801 Manual

5-position switch kickstart
Table of Contents

Advertisement

Arduino Uno

void setup() {
Serial.begin(9600);
}
void loop() {
if(digitalRead(2) == LOW)
Serial.println("Left");
if(digitalRead(3)== LOW)
Serial.println("Down");
if(digitalRead(4) == LOW)
Serial.println("Right");
if(digitalRead(5) == LOW)
Serial.println("Up");
if(digitalRead(6) == LOW)
Serial.println("Center");
delay(200);
}
Note: To view the results of the demonstration, after uploading is complete click the Serial
Monitor icon in the Arduino IDE. This displays the Serial Monitor window. Momentarily
depress the Reset button on the Arduino board to restart the sketch.

For More Information

See the
5-Position Switch (#27801)
Copyright © Parallax Inc.
full documentation.
Page 4 of 4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 27801 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents