Hello !
I use an mpu9250 and a servo.
I want to limit the servo travel, but I have a problem.
When I add each part in turn with -if-, it limits correctly, but when I put them together, it limits only one part, the bottom of the code.
What could be the cause please ..
if (value <= 20) //
{
servo.write(20);//right
}
else
{
servo.write(value);
}
if (value >= 150)
{
servo.write(150);// left
}
else
{
servo.write(value);
}
Hello !
I changed that ... Degree = (mpu.getYaw () + 180);
How many attempts did I make with the map, I forgot that I also tried the one with 0-360 degrees. The result displayed in the console, without moving the sensor ... the data is chaotic. Example ... if I set it to one degree ... the value increases and does not stop, just as if I set the sensor to 359 ... the values decrease continuously..I don't know how to try again.