Hi
I’m trying to control the motor’s rotation with a button
I want the motor to turn certain degrees when a button is pressed
so i built a function called MotorDegree, and used For loop to control the rotation. [pwm01 = MotorDegree(p1_sw_trig)]
But it appears that the motor’s movement (pwm01) doesn’t require the button’s activation (p1_sw_trig). It turns automatically once the robot initiates.
I used If command in the function so that the function runs only if the trigger is pressed (when it’s 1 or above 0)
What is wrong?