Example #1
0
    def robot_init(self):
        print 'Robot Init'
        pwm.enable()
        os.system('./map')

        #print 'Claw Init'
        #self.__claw = claw.Claw()
        #self.__claw.attach("P9_14")

        #print 'Proximity Sensor Init'
        #self.__prox =  proximity.Proximity()
        #self.__prox.attach("38", "P9_42", "48")

        print 'Motor Init'
        self.__motor = motor.Motor()
        self.__motor.attach("P9_29", "P9_31", "49", "117", "115", "60")

        print 'UDP Init'
        self.__udp = udp.PhoneStream()
        self.__udp.attach()
Example #2
0
	def robot_init(self):
		print 'Robot Init'
		pwm.enable()
		os.system('./map')
	
		#print 'Claw Init'
		#self.__claw = claw.Claw()
		#self.__claw.attach("P9_14")
			
		#print 'Proximity Sensor Init'
		#self.__prox =  proximity.Proximity()
		#self.__prox.attach("38", "P9_42", "48")
		
		print 'Motor Init'
		self.__motor = motor.Motor()
		self.__motor.attach("P9_29", "P9_31", "49", "117", "115", "60")
		
		print 'UDP Init'
		self.__udp = udp.PhoneStream()
		self.__udp.attach()
Example #3
0
import time
import pwm  #Used to enable PWM
from servo import Servo

#You can use your own method to enable PWM, but this just works
pwm.enable()

servo = Servo()
servo.attach("P9_14")

print "To middle"
servo.writeMicroseconds(1500)  #to middle
time.sleep(1)

print "To max"
servo.writeMicroseconds(2000)  #max
time.sleep(1)

print "To min"
servo.writeMicroseconds(500)  #min
time.sleep(1)
# The value in microseconds can change between servos. You can use this function to obtain the max and min values.
# Next, you can use this values to fix the servo class to your own servos (if you need it)

i = 0
while i <= 180:
    #Angle from 0 to 180 degrees
    servo.write(i)
    time.sleep(0.02)
    i = i + 1
Example #4
0
import time
import pwm #Used to enable PWM
from servo import Servo

#You can use your own method to enable PWM, but this just works
pwm.enable();

servo1 = Servo()
servo1.attach("P9_14")
servo2 = Servo()
servo2.attach("P9_16")
servo3 = Servo()
servo3.attach("P8_13")
servo4 = Servo()
servo4.attach("P8_19")

servo1.detach()
servo2.detach()
servo3.detach()
servo4.detach()

Example #5
0
import time
import pwm  # Used to enable PWM
from servo import Servo

# You can use your own method to enable PWM, but this just works
pwm.enable()


servo = Servo()
servo.attach("P9_14")

print "To middle"
servo.writeMicroseconds(1500)  # to middle
time.sleep(1)

print "To max"
servo.writeMicroseconds(2000)  # max
time.sleep(1)

print "To min"
servo.writeMicroseconds(500)  # min
time.sleep(1)
# The value in microseconds can change between servos. You can use this function to obtain the max and min values.
# Next, you can use this values to fix the servo class to your own servos (if you need it)

i = 0
while i <= 180:
    # Angle from 0 to 180 degrees
    servo.write(i)
    time.sleep(0.02)
    i = i + 1
Example #6
0
import time
import pwm #Used to enable PWM
from esc import ESC

#You can use your own method to enable PWM, but this just works
pwm.enable();


esc = ESC()
esc.attach("P9_16")

# This example works with aeolian car (double direction) ESC which minimum throttle is 80.
# Try changing values until you found the right value for your ESC
esc.write(80)
#esc.writeMicroseconds(1600)
#Now the ESC es ready, in my case if I use values less than 80 the motor goes rearward
# and if the values are greater than 80 the motor goes fordward