例程代码:
#include <Esplora.h>
void setup() {
while(!Serial);
Serial.begin(9600);
}
void loop() {
dumpInputs();
delay(1000);
}
void dumpInputs() {
Serial.print(Esplora.readButton(SWITCH_1));
Serial.print(',');
Serial.print(Esplora.readButton(SWITCH_2));
Serial.print(',');
Serial.print(Esplora.readButton(SWITCH_3));
Serial.print(',');
Serial.print(Esplora.readButton(SWITCH_4));
Serial.print(',');
Serial.print(Esplora.readSlider());
Serial.print(',');
Serial.print(Esplora.readLightSensor());
Serial.print(',');
Serial.print(Esplora.readTemperature(DEGREES_C));
Serial.print(',');
Serial.print(Esplora.readMicrophone()); Serial.print(','); Serial.print(Esplora.readJoystickSwitch()); Serial.print(','); Serial.print(Esplora.readJoystickX()); Serial.print(','); Serial.print(Esplora.readJoystickY()); Serial.print(','); Serial.print(Esplora.readAccelerometer(X_AXIS)); Serial.print(','); Serial.print(Esplora.readAccelerometer(Y_AXIS)); Serial.print(','); Serial.print(Esplora.readAccelerometer(Z_AXIS)); Serial.println();
}