From fb87c81cb0cb19da8e15e8bdff70a1910b8d4fd9 Mon Sep 17 00:00:00 2001 From: Tom Igoe Date: Sun, 23 Dec 2012 22:10:07 -0500 Subject: [PATCH] Added comments for EsploraPong --- .../Experts/EsploraPong/EsploraPong.ino | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino b/libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino index b52e49b71..725a109f3 100644 --- a/libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino +++ b/libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino @@ -22,22 +22,23 @@ #include void setup() { - Serial.begin(9600); + Serial.begin(9600); // initialize serial communication } void loop() { + // read the slider and three of the buttons int slider = Esplora.readSlider(); - int resetButton = Esplora.readButton(1); - int serveButton = Esplora.readButton(3); - int switchPlayerButton = Esplora.readButton(4); + int resetButton = Esplora.readButton(SWITCH_1); + int serveButton = Esplora.readButton(SWITCH_3); + int switchPlayerButton = Esplora.readButton(SWITCH_4); - Serial.print(slider); - Serial.print(","); - Serial.print(resetButton); - Serial.print(","); - Serial.print(serveButton); - Serial.print(","); - Serial.println(switchPlayerButton); - delay(10); + Serial.print(slider); // print the slider value + Serial.print(","); // add a comma + Serial.print(resetButton); // print the reset button value + Serial.print(","); // add another comma + Serial.print(serveButton); // print the serve button value + Serial.print(","); // add another comma + Serial.println(switchPlayerButton); // print the last button with a newline + delay(10); // delay before sending the next set }