Arduino Esplora 板载器件测试

发布于: 27 January, 2014
分享:

例程代码:

#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(); }

分享:

0 留言

留言

您的留言将被人工审核,请勿发表色情、反动言论。