I can't make my brushless motor move; it kepps on beeping. I have connected it to an electronic speed control (ESC) and am trying to signal the ESC from the GPIO pins of Raspberry pi B+. How do I initialize my ESC with the correct PWM signals with the Python code.
I suggest you have a look at the answer I gave to Controlling a brushed motor ESC from the Raspberry Pi
If that works it will be trivial to use Python instead.
Example pigpio Python code
#!/usr/bin/env python # esc_start.py # 2015-04-14 # Public Domain # # Sends the servo pulses needed to initialise some ESCs # # Requires the pigpio daemon to be running # # sudo pigpiod import time import pigpio SERVO = 4 pi = pigpio.pi() # Connect to local Pi. pi.set_servo_pulsewidth(SERVO, 1000) # Minimum throttle. time.sleep(1) pi.set_servo_pulsewidth(SERVO, 2000) # Maximum throttle. time.sleep(1) pi.set_servo_pulsewidth(SERVO, 1100) # Slightly open throttle. time.sleep(1) pi.set_servo_pulsewidth(SERVO, 0) # Stop servo pulses. pi.stop() # Disconnect from local Raspberry Pi.
RPIO.GPIO (note: not RPi.GPIO) and pigpio both send DMA timed pulses from within Python. You can also use the servoblaster module, but you need to control it via its file interface.
Other modules will use software-timed PWM which will not be as reliable (timing jitter).