I’m working on an automatic brake light sensor that will activate and LED when a certain level of deceleration is experienced. I’m reading data in from the MPU6050, but whenever I rotate it the acceleration values change along with the gyroscope values. I’m new to Arduino and I can’t figure out why this is happening. I’m using an Arduino UNO. My code is down below, any help would be much appreciated.
For example, when lying flat on the table the acceleration values are constant. But when I rotate the accelerometer 90 degrees, the values for the acceleration will change dramatically, even though there should be no linear acceleration. Also, the gyroscope values change when linear acceleration is experienced.
brakeSensor2.0.ino (5.16 KB)