Home        Store        Docs        Blog

Thruster program python


(christos) #1

I am using a Raspberry Pi 2, Afro ESC’s, and t100 thrusters. I am a beginner. I am trying to connect the t100 thrusters to my raspberry pi 2. I had operated thruster with GPIO Pin. But i haven’t been working work. And connect with lumen light worked. What’s happening?

Thanks
Christos

My program:
from pygame import *
import RPi.GPIO as GPIO
import time
import pigpio

pi = pigpio.pi()
init()
screen = display.set_mode((640, 480))
display.set_caption(‘the program’)

motor1=23
motor2=24
led1=22
led2=25

endProgram = False

while not endProgram:
for e in event.get():
if e.type ==KEYDOWN:
if (e.key == K_a):
print (“key a”)
pi.set_servo_pulsewidth(motor1, 1200)
pi.set_servo_pulsewidth(motor2, 1200)
pi.set_servo_pulsewidth(led1, 1300)
pi.set_servo_pulsewidth(led2, 1300)
time.sleep(1)
elif (e.key == K_c):
print(“key c”)
pi.set_servo_pulsewidth(motor1, 1800)
pi.set_servo_pulsewidth(motor2, 1850)
pi.set_servo_pulsewidth(led1, 1700)
pi.set_servo_pulsewidth(led2, 1700)
time.sleep(1)
elif (e.key == K_b):
print(“key b”)
pi.set_servo_pulsewidth(motor1, 1700)
pi.set_servo_pulsewidth(motor2, 1750)
pi.set_servo_pulsewidth(led1, 1300)
pi.set_servo_pulsewidth(led2, 1300)
time.sleep(1)
elif (e.key == K_q):
print(“key b”)
pi.set_servo_pulsewidth(motor1, 0)
pi.set_servo_pulsewidth(motor2, 0)
pi.set_servo_pulsewidth(led1, 0)
pi.set_servo_pulsewidth(led2, 0)
time.sleep(1)
elif e.key == K_ESCAPE:
endProgram = True
else:
print (“error”)


(Patrick José Pereira) #2

Hi Christos,

Are you using the same ground between the ESC and the raspberry ?