Exemplo n.º 1
0
    def __init__(self, channel, frequency=50):
        self.channel = channel
        self.frequency = frequency

        # check that pwm-exp has been initialized
        bInit = pwmExp.checkInit()

        if (bInit == 0):
            # initialize the Expansion
            ret = pwmExp.driverInit()
            if (ret != 0):
                print 'ERROR: pwm-exp init not successful!'

            # set to default frequency
            self._setFrequency(self.frequency)
Exemplo n.º 2
0
	def __init__(self, channel):
		self.channel 	= channel
		self.frequency 	= SERVO_FREQUENCY

		# check that pwm-exp has been initialized
		bInit 	= pwmExp.checkInit()

		if (bInit == 0):
			# initialize the expansion
			ret 	= pwmExp.driverInit()
			if (ret != 0):
				print 'ERROR: pwm-exp init not successful!'

			# set to default frequency
			self._setFrequency(self.frequency)
Exemplo n.º 3
0
import OmegaExpansion.pwmExp as pwm
import sys

status = pwm.driverInit()

if pwm.checkInit() == 0:
    print("PWM Init failed")
    exit

lr = float(sys.argv[1])
ud = float(sys.argv[2])

pwm.setFrequency(50)
pwm.setupDriver( 0, lr, 0)
pwm.setupDriver(15, ud, 0)
Exemplo n.º 4
0
from OmegaExpansion import pwmExp
import time
import sys

# check the arguments
channel = 0
if len(sys.argv) == 2:
    channel = int(sys.argv[1])

print '>> Using channel ', channel

pwmExp.setVerbosity(0)

# check initialization
#	should return 0 if the PWM Expansion has just been plugged in
ret = pwmExp.checkInit()
print "checking if initialized: ", ret

# initialize the pwm-exp
ret = pwmExp.driverInit()
print "driverInit return: ", ret
if (ret != 0):
    exit()
ret = pwmExp.setFrequency(50)
print "setFrequency return: ", ret
if (ret != 0):
    exit()

# check initialization
#	should return 1 since the Expansion was initialized above
ret = pwmExp.checkInit()
Exemplo n.º 5
0
from OmegaExpansion import pwmExp
import time
import sys

# check the arguments
channel = 0
if len(sys.argv) == 2:
	channel = int(sys.argv[1])

print '>> Using channel ', channel

pwmExp.setVerbosity(0)

# check initialization
#	should return 0 if the PWM Expansion has just been plugged in
ret 	= pwmExp.checkInit()
print "checking if initialized: ", ret

# initialize the pwm-exp
ret 	= pwmExp.driverInit()
print "driverInit return: ", ret
if (ret != 0):
	exit()
ret 	= pwmExp.setFrequency(50)	
print "setFrequency return: ", ret
if (ret != 0):
	exit()

# check initialization
#	should return 1 since the Expansion was initialized above
ret 	= pwmExp.checkInit()