I am a very new to raspberry pi and hardware. I am trying to spin a brushless motor with ESC. below is the code (taken from a youtube video) that spins the motor till 9 and then slows it down till 4. but I want to run the motor without loops and without changing the duty cycles. Means when i run the program the motor should spin and when i stop the program the motor should stop spinning. Please update the below code. Sorry for my bad English. I hope I am clear what I need. Below is the code that I have taken from a video. Code: p = GPIO.PWM(7, 50) p.start(0) print ("starting 0") time.sleep(3) p.ChangeDutyCycle(3) print("start") time.sleep(5) while True: i = 4 while i<10: print(i) p.ChangeDutyCycle(i) time.sleep(.05) i +=.02 while i>4: print(i) p.ChangeDutyCycle(i) time.sleep(.05) i -=.05 Continue reading...