[vc_row][vc_column width=”1/1″][vc_column_text]
[/vc_column_text][vc_text_separator title=”Code” title_align=”separator_align_center”][vc_column_text]
#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();
}
[/vc_column_text][vc_column_text]
The above code can be downloaded at: EsploraTest.
[/vc_column_text][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.