what if you change your leftright and updown conditions:
if (leftright > 100), if (updown > 100) [instead of if... < 100]
if (leftright < -100), if (updown > 100) [instead of if... > -100]
I guess you lost interest, found other things to do, or whatever.
I wrote the following sketch to confirm my postulate and to check out the SIP strip I/O.
0 is neutral; as the nose rises from neutral Y-axis outputs positive and as the nose dips Y-axis outputs negative.
It lights one of three external LEDs based on the pitch (Y-axis) of the Esplora --
#include <Esplora.h>
const byte pospitch = 1;
const byte negpitch = 0;
const byte neut = 8;
void setup()
{
Serial.begin(9600); // initialize serial communications with your computer
pinMode (pospitch, OUTPUT);
pinMode (negpitch, OUTPUT);
pinMode (neut, OUTPUT);
}
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
if (yAxis > 80)
{
digitalWrite (pospitch, HIGH);
digitalWrite (negpitch, LOW);
digitalWrite (neut, LOW);
}
if (yAxis < -20)
{
digitalWrite (pospitch, LOW);
digitalWrite (negpitch, HIGH);
digitalWrite (neut, LOW);
}
if ((yAxis < 80) && (yAxis > -20))
{
digitalWrite (pospitch, LOW);
digitalWrite (negpitch, LOW);
digitalWrite (neut, HIGH);
}
delay(100); // wait half a second (500 milliseconds)
}
It seems that the output isn't symmetrical (degrees +/- : output +/-)