Home > other >  Small white help, ADXL335 tilt sensor in esp8266 esp8266 V3 after 12 n F, xyz why wrong
Small white help, ADXL335 tilt sensor in esp8266 esp8266 V3 after 12 n F, xyz why wrong

Time:10-03

 
# define xPin 4
# define yPin 0
# define zPin 2

Int sampleDelay=500;
Void setup () {
Serial. The begin (9600);

PinMode (xPin, INPUT);
PinMode (yPin, INPUT);
PinMode (zPin, INPUT);
}

Void loop () {
Int x=analogRead (xPin);
Delay (1);
Int y=analogRead (yPin);
Delay (1);
Int z=analogRead (zPin);
Delay (1);
Float zero_G=512.0;
Float scale=102.3;
Serial. Print (((float) X-ray zero_G)/scale);
Serial. Print (" \ t ");
Serial. Print (((float) y - zero_G)/scale);
Serial. Print (" \ t ");
Serial. Print (((float) z - zero_G)/scale);
Serial. Print (" \ n ");
Delay (sampleDelay);

}


  • Related