1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-06 01:08:25 +01:00

Added comments for EsploraPong

This commit is contained in:
Tom Igoe 2012-12-23 22:10:07 -05:00
parent fbd488e07e
commit fb87c81cb0

View File

@ -22,22 +22,23 @@
#include <Esplora.h> #include <Esplora.h>
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600); // initialize serial communication
} }
void loop() { void loop() {
// read the slider and three of the buttons
int slider = Esplora.readSlider(); int slider = Esplora.readSlider();
int resetButton = Esplora.readButton(1); int resetButton = Esplora.readButton(SWITCH_1);
int serveButton = Esplora.readButton(3); int serveButton = Esplora.readButton(SWITCH_3);
int switchPlayerButton = Esplora.readButton(4); int switchPlayerButton = Esplora.readButton(SWITCH_4);
Serial.print(slider); Serial.print(slider); // print the slider value
Serial.print(","); Serial.print(","); // add a comma
Serial.print(resetButton); Serial.print(resetButton); // print the reset button value
Serial.print(","); Serial.print(","); // add another comma
Serial.print(serveButton); Serial.print(serveButton); // print the serve button value
Serial.print(","); Serial.print(","); // add another comma
Serial.println(switchPlayerButton); Serial.println(switchPlayerButton); // print the last button with a newline
delay(10); delay(10); // delay before sending the next set
} }