Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb87c81

Browse filesBrowse files
committed
Added comments for EsploraPong
1 parent fbd488e commit fb87c81
Copy full SHA for fb87c81

File tree

Expand file treeCollapse file tree

1 file changed

+13
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-12
lines changed

‎libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino

Copy file name to clipboardExpand all lines: libraries/Esplora/examples/Experts/EsploraPong/EsploraPong.ino
+13-12Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,23 @@
2222
#include <Esplora.h>
2323

2424
void setup() {
25-
Serial.begin(9600);
25+
Serial.begin(9600); // initialize serial communication
2626
}
2727

2828
void loop() {
29+
// read the slider and three of the buttons
2930
int slider = Esplora.readSlider();
30-
int resetButton = Esplora.readButton(1);
31-
int serveButton = Esplora.readButton(3);
32-
int switchPlayerButton = Esplora.readButton(4);
31+
int resetButton = Esplora.readButton(SWITCH_1);
32+
int serveButton = Esplora.readButton(SWITCH_3);
33+
int switchPlayerButton = Esplora.readButton(SWITCH_4);
3334

34-
Serial.print(slider);
35-
Serial.print(",");
36-
Serial.print(resetButton);
37-
Serial.print(",");
38-
Serial.print(serveButton);
39-
Serial.print(",");
40-
Serial.println(switchPlayerButton);
41-
delay(10);
35+
Serial.print(slider); // print the slider value
36+
Serial.print(","); // add a comma
37+
Serial.print(resetButton); // print the reset button value
38+
Serial.print(","); // add another comma
39+
Serial.print(serveButton); // print the serve button value
40+
Serial.print(","); // add another comma
41+
Serial.println(switchPlayerButton); // print the last button with a newline
42+
delay(10); // delay before sending the next set
4243
}
4344

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.