I just bought an Esplora. It's my first product from Arduino. Most of its features work perfectly. My only problem relates to the accelerometer which is doing several unexpected things. I'm using the built-in example code to test the accelerometer, here's the code:
#include <Esplora.h>
void setup()
{
Serial.begin(9600); // initialize serial communications with your computer
}
void loop()
{
int xAxis = Esplora.readAccelerometer(X_AXIS); // read the X axis
int yAxis = Esplora.readAccelerometer(Y_AXIS); // read the Y axis
int zAxis = Esplora.readAccelerometer(Z_AXIS); // read the Z axis
Serial.print("x: "); // print the label for X
Serial.print(xAxis); // print the value for the X axis
Serial.print("\ty: "); // print a tab character, then the label for Y
Serial.print(yAxis); // print the value for the Y axis
Serial.print("\tz: "); // print a tab character, then the label for Z
Serial.println(zAxis); // print the value for the Z axis
delay(500); // wait half a second (500 milliseconds)
}
Shouldn't the accelerometer report changes in all 3 dimensions? When I rotate the Esplora around a vertical access (think: spin it on a table) none of the three readouts change. Nothing! (They all stay around 15,15,160.) When I hold it like I would a game controller, then raise my hands in opposite directions (left=up, right=down) the X_AXIS and the Z_AXIS results change approximately the same amounts. When I tilt it forwards or backwards the Y_AXIS and the Z_AXIS results change approximately the same amounts.
Am I just misunderstanding how accelerometers work? To me they should independently map the three different axes. But as far as I can tell the value for Z_AXIS represents some strange axis that I'm unable to pin down. So I've only got two dimensions that work, and they aren't my preferred ones.
A second problem is that I would have imagined they would report values something like "0..359" or maybe "-180..180" but instead they peak around "-150" and "+170". And the peaks aren't the same for each axis. So the numerical range isn't 360 but around 320. Yes, I can map these values to proper mathematical values, but it's a minor complication I could do without.
A third problem is that they should be proportional to the amount that you turn them. But when I turn my Esplora very very slowly the numbers often go like this: "120 121 122 123 150 151" Why does it jump so suddenly? And at other times it doesn't change the reading at all even though I've turned the Esplora a lot!
The label on the Esplora board next to its accelerometer shows where the X, Y and Z axes should be located. Based on what I observe when I run the program above they mixed up the X and Y in the diagram, and the Z doesn't work when I rotate the device around the Z-axis.
Disclaimer: I'm an idiot on occasion.