PLease use the # button to get code tags , makes at least the look better.
some observations:
- why not use higher baudrate 115200 is 12 times faster
- if code and comments differ the code wins ==> check the delay(1000) in your code
- you need to add extra ()'s in the boolean statement to enforce what you really want (I guess)
see my change in the code below.
=> google for short circuit boolean evaluation why you should do that. (operator precedence is also a good reader)
int x, y, z;
void setup()
{
Serial.begin(115200); <<<<<<<<<<<<<<<<<<<<
}
void loop()
{
x = analogRead(0); // read analog input pin 0
y = analogRead(1); // read analog input pin 1
z = analogRead(2); // read analog input pin 2
Serial.print("accelerations are x, y, z: ");
Serial.print(x, DEC); // print the acceleration in the X axis
Serial.print(" "); // prints a space between the numbers
Serial.print(y, DEC); // print the acceleration in the Y axis
Serial.print(" "); // prints a space between the numbers
Serial.println(z, DEC); // print the acceleration in the Z axis
delay(1000);// wait 100ms for next reading <<<<<<<<<<<<<<<<<<
if ((x<375||x>390) && (y<375||y>390) && (z<310||z>325)) <<<<<<<<<<<<<<<<
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}