Hello! I have to make this simple project but I have a big problem: the accelerometer in the picture (5 pins, power supply plus the 3 axes) is impossible to find, so I have bought a very common ADXL345 like this one.
Now, my problem is that I don't know how to connect it with the Arduino Uno board. Which accelerometer pins should go to the A0, A2 and A4 arduino pins? Or how do I need to modify the code below in order to use the ADXL345 accelerometer? It should be a minimal change in the code, one that a noob kid is supposed to be able to make.
THANK YOU!
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(A2, INPUT);
pinMode(A4, INPUT);
pinMode(12, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int x = analogRead(A0);
int y = analogRead(A2);
int z = analogRead(A4);
I have a big problem: the accelerometer in the picture (5 pins, power supply plus the 3 axes) is impossible to find
The ADXL337 is a chip with 3 analog outputs as the instructable seems to use.
Now, my problem is that I don't know how to connect it with the Arduino Uno board. Which accelerometer pins should go to the A0, A2 and A4 arduino pins? Or how do I need to modify the code below in order to use the ADXL345 accelerometer?
The ADXL345 is an accelerometer with digital output, so it cannot be used with the posted code.
Thank you very much, now I see. Then could somebody please help me with a few code lines to be added to the code below? I have tested it and it works fine, I just need to trigger the pin 12 (a buzzer) when the ADXL345 records vibrations.
Thank you!