Acelerometro ADXL335

I’m making a control to a tilt trailer however I can not see where I can not trigger the buzzer and the led. Someone with more knowledge used for millis * * and do not know if it is correct to define ask for help from colleagues. Not giving error when compiling more movement when the accelerometer he does not fire after 5 seg.como described in the sketch. (Google Translation)

#include <mills.h>
const int eixoX =A1;
const int eixoY =A2;
//const int eixoZ =A3;

int X;
int Y;
//int Z;
int led = 7;
int buzzer = 8;

// Serial.print(" Z:");
// Serial.print(Z);


if (X<310 || X>400){

Should be if (X<310 && X>400), now what happens if X = 310 or X = 400?

if (fora_do_eixo = 0)

= or ==? Are you assigning 0 to fora_do_eixo or comparing them?

if (millis() - tempo_antes > 5000 && fora_do_eixo==1)

Its better to separate them with parentheses

if ( (millis() - tempo_antes >= 5000) && (fora_do_eixo==1) )

I made the mudaças more does not trigger the buzzer and the led. You may be I am blind and can not see the problem. Please give me a light

Thank you

What are the values of X and Y?

You only fixed one thing, what about the other two if statements? You have || when you should be using &&.

And you still haven't told me what you are getting for X and Y

What I am saying to do is to look if it the values are ever on the inside.

If one of your readings is within 310 - 400, then fora_do_eixo = 0, otherwise it is 1.

if( (X > 310 && X < 400) || (Y > 310 && Y < 400) ) // note the different operators
fora_do_eixo = 0; //If X or Y is within 310 - 400, false
fora_do_eixo = 1; // If both are outside 310 - 400, true