#include "SoftwareSerial.h" // Testing the accelerometer SoftwareSerial mySerial(10,9); // RX, TX const int xAxis = 1; const int yAxis = 2; const int zAxis = 3; int sensorX =0; int sensorY =0; int sensorZ =0; void setup() { // put your setup code here, to run once: pinMode (xAxis, INPUT); pinMode (yAxis, INPUT); pinMode (zAxis, INPUT); mySerial.begin(9600); mySerial.println("Hello, world?"); } void loop() { // put your main code here, to run repeatedly: sensorX = analogRead (xAxis); // read the accelerometer sensorY = analogRead (yAxis); sensorZ = analogRead (zAxis); sensorX = constrain (sensorX, 261, 399); // keep the numbers within a range so it doesn't take huge sensorY = constrain (sensorY, 261, 399); // jolts to get bright colors sensorZ = constrain (sensorZ, 264, 400); // the values returned for resting rotation through the range of motion are // X [266-400] Y [263-395] z [264-395] so 395 is 1g mySerial.println(sensorX); }