#define X_PIN 0 #define Y_PIN 1 #define Z_PIN 2 void setup() { Serial.begin(9600); analogReference(EXTERNAL); } void loop(){ float xAcc=readAcc(X_PIN); float yAcc=readAcc(Y_PIN); float zAcc=readAcc(Z_PIN); Serial.print(xAcc,DEC); Serial.print(","); Serial.print(yAcc,DEC); Serial.print(","); Serial.print(zAcc,DEC); Serial.println(";"); } float readAcc(int port){ int value=analogRead(port); int miliVolts=map(value,0,1023,0,3300)-3300/2; float acc=(float)miliVolts/360; return acc; }