circuit accelerometer - vibratie

Bedankt voor de talrijke nuttige reacties.
Na een beetje gespeeld te hebben met code is het me gelukt om de accelerometer naar mijn wensen te calibreren.

Nu zit ik nog met één vraagje. Indien de accelerometer een bepaalde waarde bereikt (uitwijking) moet de led oplichten. Normaal gezien doe ik dit gewoon met de analogValue die binnenkomt langs de Sensor. Maar omdat deze nu aangepast zijn en omgezet zijn kan ik dit niet gebruiken

Ik weet dat je dit normaliter doet met volgende code in de voide loop ():

if (uitwijking >= 15){
digitalWrite(led1, HIGH);
alse {
digitalWrite(led1, LOW);

Ik weet enkel niet welke variabele ik bij "uitwijking" moet zetten. Ik krijg steeds fouten als ik wat probeer. Omdat de analoge waarden die ik meet zowizo boven de 15 zitten. Maar degene die op de seriële monitor geprint worden niet omdat deze omgevormd zijn.
Hebben jullie hiervoor een oplossing?
De code staat hier onder

const static boolean GFORCE = true;
const static boolean METERS = false;


byte _sleepPin= 4;
byte _GS= 5;
byte _xpin= A0;
byte _ypin = A1;


int _gc = 92;//gravity constant (inverted for proper sinage)
int _0x = 660; //defaults to read values
int _0y = 677; //defaults to reasonable values
boolean _calibrated=false;


int led1 = 10;


void setup()
{
Serial.begin(9600);
begin();//runs setup
calibrate();
pinMode(10, OUTPUT);
}

void loop()
{
delay(3000); //Delay for readability


Serial.println();
Serial.println("In Meters Per Second-Squared:");
readMx();
readMy();


}
void begin()
{
pinMode(_sleepPin,OUTPUT);//output mode
pinMode(_GS,OUTPUT);//output mode
pinMode(_xpin, INPUT);//input mode
pinMode(_ypin, INPUT);//input mode


digitalWrite(_GS,LOW);//sets GS mode
digitalWrite(_sleepPin, HIGH);//turns off sleep mode and activates device
digitalWrite(_xpin, HIGH);//turn on pull up resistor
digitalWrite(_ypin, HIGH);//turn on pull up resistor

}


void calibrate()
{
Serial.println("Please place device right-side up on a flat surface.");
delay(3000);//give user two seconds to comply.
Serial.println("Calibrating");


_0x = readAverage(_xpin, 10);
Serial.print("X Axis Calibrated:"); Serial.println(_0x);
_0y = readAverage(_ypin, 10);
Serial.print("Y Axis Calibrated:"); Serial.println(_0y);

_calibrated = true;
}
int readAverage(int pin, int samples)
{
long readings = 0;

for(int i = 0; i < samples; i++)
{
readings += analogRead(pin);
}

return (readings/samples);
}

float convert(float myReading, float my0G)
{
return convert(myReading, my0G, GFORCE);//defaults to G-Forces
}

float convert(float myReading, float my0G, bool myUnits)
{
float myResult=((my0G-myReading)/(_gc));
if(myUnits)
return myResult; //G-Forces
else
return (myResult * 9.80665 * 10);


//converts to m/s^2 using conventional value for gravity.
//if you are on a different planet you may need to use a
//value for your conversions.
}

void readMx()
{
Serial.print("X Reading: ");
Serial.println(convert(analogRead(_xpin), _0x, METERS));
}

void readMy()
{
Serial.print("Y Reading: ");
Serial.println(convert(analogRead(_ypin), _0y, METERS));
}