Hi. I’m stuck with a project for a long. Can anyone help me out?
I’m trying to create an Arduino project with a gyroscope(mpu6050). The idea is that whenever the
gyroscope axis gyX,gyY,gyZ returns an expected value of (0,-1,0) for “5” seconds, the leds should
turn ON. And i want this to happen inside a loop function. So whenever i keep the gyro on a flat
surface/ a table without disturbing, the leds should turn ON. And whenever I interrupt the gyro,
the leds should turn OFF.
Basically an if condition executes a statement when the condition is True for 5 seconds.
This count should reset everytime I intruput the gyro. I’ve attched my code in this forum.
I used millis in this code. The leds turns ON right after the gyroscope values return the expected value.
But what I want is the leds to turn ON only if the gyroscope return expected values for minimum of “5” seconds.
Gyro_Leds.ino (719 Bytes)