mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,28 +1,28 @@
|
||||
/*
|
||||
Esplora Remote
|
||||
|
||||
|
||||
This sketch allows to test all the Esplora's peripherals.
|
||||
It is also used with the ProcessingStart sketch (for Processing).
|
||||
|
||||
|
||||
When uploaded, you can open the Serial monitor and write one of
|
||||
the following commands (without quotes) to get an answer:
|
||||
|
||||
|
||||
"D": prints the current value of all sensors, separated by a comma.
|
||||
See the dumpInputs() function below to get the meaning of
|
||||
each value.
|
||||
|
||||
|
||||
"Rxxx"
|
||||
"Gxxx"
|
||||
"Bxxx": set the color of the RGB led. For example, write "R255"
|
||||
to turn on the red to full brightness, "G128" to turn
|
||||
the green to half brightness, or "G0" to turn off
|
||||
the green channel.
|
||||
|
||||
|
||||
"Txxxx": play a tone with the buzzer. The number is the
|
||||
frequency, e.g. "T440" plays the central A note.
|
||||
Write "T0" to turn off the buzzer.
|
||||
|
||||
|
||||
|
||||
|
||||
Created on 22 november 2012
|
||||
By Enrico Gueli <enrico.gueli@gmail.com>
|
||||
Modified 23 Dec 2012
|
||||
@ -32,7 +32,7 @@
|
||||
#include <Esplora.h>
|
||||
|
||||
void setup() {
|
||||
while(!Serial); // needed for Leonardo-based board like Esplora
|
||||
while (!Serial); // needed for Leonardo-based board like Esplora
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
@ -48,53 +48,53 @@ void loop() {
|
||||
*/
|
||||
void parseCommand() {
|
||||
char cmd = Serial.read();
|
||||
switch(cmd) {
|
||||
case 'D':
|
||||
dumpInputs();
|
||||
break;
|
||||
case 'R':
|
||||
setRed();
|
||||
break;
|
||||
case 'G':
|
||||
setGreen();
|
||||
break;
|
||||
case 'B':
|
||||
setBlue();
|
||||
break;
|
||||
case 'T':
|
||||
setTone();
|
||||
break;
|
||||
switch (cmd) {
|
||||
case 'D':
|
||||
dumpInputs();
|
||||
break;
|
||||
case 'R':
|
||||
setRed();
|
||||
break;
|
||||
case 'G':
|
||||
setGreen();
|
||||
break;
|
||||
case 'B':
|
||||
setBlue();
|
||||
break;
|
||||
case 'T':
|
||||
setTone();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dumpInputs() {
|
||||
Serial.print(Esplora.readButton(SWITCH_1));
|
||||
void dumpInputs() {
|
||||
Serial.print(Esplora.readButton(SWITCH_1));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readButton(SWITCH_2));
|
||||
Serial.print(Esplora.readButton(SWITCH_2));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readButton(SWITCH_3));
|
||||
Serial.print(Esplora.readButton(SWITCH_3));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readButton(SWITCH_4));
|
||||
Serial.print(Esplora.readButton(SWITCH_4));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readSlider());
|
||||
Serial.print(Esplora.readSlider());
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readLightSensor());
|
||||
Serial.print(Esplora.readLightSensor());
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readTemperature(DEGREES_C));
|
||||
Serial.print(Esplora.readTemperature(DEGREES_C));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readMicrophone());
|
||||
Serial.print(Esplora.readMicrophone());
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readJoystickSwitch());
|
||||
Serial.print(Esplora.readJoystickSwitch());
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readJoystickX());
|
||||
Serial.print(Esplora.readJoystickX());
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readJoystickY());
|
||||
Serial.print(Esplora.readJoystickY());
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readAccelerometer(X_AXIS));
|
||||
Serial.print(Esplora.readAccelerometer(X_AXIS));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readAccelerometer(Y_AXIS));
|
||||
Serial.print(Esplora.readAccelerometer(Y_AXIS));
|
||||
Serial.print(',');
|
||||
Serial.print(Esplora.readAccelerometer(Z_AXIS));
|
||||
Serial.print(Esplora.readAccelerometer(Z_AXIS));
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user