You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# coding: utf-8importFabo_PCA9685importtimeimportpkg_resourcesSMBUS='smbus'fordistinpkg_resources.working_set:
#print(dist.project_name, dist.version)ifdist.project_name=='smbus':
breakifdist.project_name=='smbus2':
SMBUS='smbus2'breakifSMBUS=='smbus':
importsmbuselifSMBUS=='smbus2':
importsmbus2assmbus# initBUSNUM=1SERVO_HZ=50INITIAL_VALUE=300bus=smbus.SMBus(BUSNUM)
PCA9685=Fabo_PCA9685.PCA9685(bus,INITIAL_VALUE)
PCA9685.set_hz(SERVO_HZ)
# set valuevalue=330channel=0# PWM0番目のピンのサーボPCA9685.set_channel_value(channel,value)
# get value(Get chip register's value. This value may not be equal to the actual position.)value=PCA9685.get_channel_value(channel)
print(value)
time.sleep(1)
value=300channel=0# PWM0番目のピンのサーボPCA9685.set_channel_value(channel,value)
# get value(Get chip register's value. This value may not be equal to the actual position.)value=PCA9685.get_channel_value(channel)
print(value)