# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_pyupm_adafruitss', [dirname(__file__)])
except ImportError:
import _pyupm_adafruitss
return _pyupm_adafruitss
if fp is not None:
try:
_mod = imp.load_module('_pyupm_adafruitss', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_adafruitss = swig_import_helper()
del swig_import_helper
else:
import _pyupm_adafruitss
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
def getVersion():
return _pyupm_adafruitss.getVersion()
getVersion = _pyupm_adafruitss.getVersion
_pyupm_adafruitss.MAX_BUFFER_LENGTH_swigconstant(_pyupm_adafruitss)
MAX_BUFFER_LENGTH = _pyupm_adafruitss.MAX_BUFFER_LENGTH
_pyupm_adafruitss.SERVO_MIN_swigconstant(_pyupm_adafruitss)
SERVO_MIN = _pyupm_adafruitss.SERVO_MIN
_pyupm_adafruitss.SERVO_MAX_swigconstant(_pyupm_adafruitss)
SERVO_MAX = _pyupm_adafruitss.SERVO_MAX
_pyupm_adafruitss.SERVO_FREQ_swigconstant(_pyupm_adafruitss)
SERVO_FREQ = _pyupm_adafruitss.SERVO_FREQ
_pyupm_adafruitss.PCA9685_SUBADR1_swigconstant(_pyupm_adafruitss)
PCA9685_SUBADR1 = _pyupm_adafruitss.PCA9685_SUBADR1
_pyupm_adafruitss.PCA9685_SUBADR2_swigconstant(_pyupm_adafruitss)
PCA9685_SUBADR2 = _pyupm_adafruitss.PCA9685_SUBADR2
_pyupm_adafruitss.PCA9685_SUBADR3_swigconstant(_pyupm_adafruitss)
PCA9685_SUBADR3 = _pyupm_adafruitss.PCA9685_SUBADR3
_pyupm_adafruitss.PCA9685_MODE1_swigconstant(_pyupm_adafruitss)
PCA9685_MODE1 = _pyupm_adafruitss.PCA9685_MODE1
_pyupm_adafruitss.PCA9685_PRESCALE_swigconstant(_pyupm_adafruitss)
PCA9685_PRESCALE = _pyupm_adafruitss.PCA9685_PRESCALE
_pyupm_adafruitss.LED0_ON_L_swigconstant(_pyupm_adafruitss)
LED0_ON_L = _pyupm_adafruitss.LED0_ON_L
_pyupm_adafruitss.LED0_ON_H_swigconstant(_pyupm_adafruitss)
LED0_ON_H = _pyupm_adafruitss.LED0_ON_H
_pyupm_adafruitss.LED0_OFF_L_swigconstant(_pyupm_adafruitss)
LED0_OFF_L = _pyupm_adafruitss.LED0_OFF_L
_pyupm_adafruitss.LED0_OFF_H_swigconstant(_pyupm_adafruitss)
LED0_OFF_H = _pyupm_adafruitss.LED0_OFF_H
_pyupm_adafruitss.ALLLED_ON_L_swigconstant(_pyupm_adafruitss)
ALLLED_ON_L = _pyupm_adafruitss.ALLLED_ON_L
_pyupm_adafruitss.ALLLED_ON_H_swigconstant(_pyupm_adafruitss)
ALLLED_ON_H = _pyupm_adafruitss.ALLLED_ON_H
_pyupm_adafruitss.ALLLED_OFF_L_swigconstant(_pyupm_adafruitss)
ALLLED_OFF_L = _pyupm_adafruitss.ALLLED_OFF_L
_pyupm_adafruitss.ALLLED_OFF_H_swigconstant(_pyupm_adafruitss)
ALLLED_OFF_H = _pyupm_adafruitss.ALLLED_OFF_H
_pyupm_adafruitss.PCA9685_MODE1_REG_swigconstant(_pyupm_adafruitss)
PCA9685_MODE1_REG = _pyupm_adafruitss.PCA9685_MODE1_REG
_pyupm_adafruitss.PCA9685_PRESCALE_REG_swigconstant(_pyupm_adafruitss)
PCA9685_PRESCALE_REG = _pyupm_adafruitss.PCA9685_PRESCALE_REG
_pyupm_adafruitss.LED0_REG_swigconstant(_pyupm_adafruitss)
LED0_REG = _pyupm_adafruitss.LED0_REG
[docs]class adafruitss(_object):
"""
API for the Adafruit Servo Shield.
ID: adafruitss
Name: Adafruit Servo Shield
Category: servos
Manufacturer: adafruit
Link:http://www.adafruit.com/product/1411
Connection: i2c UPM library for the PCA9685-based Adafruit 16-channel
servo shield. If 3 or more GWS servos are attached, results could be
unpredictable. Adafruit Industries recommend installing a capacitor on
the board, which should alleviate the issue. Sizing depends on servos
and their number.
C++ includes: adafruitss.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, adafruitss, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, adafruitss, name)
__repr__ = _swig_repr
def __init__(self, bus, i2c_address):
"""
adafruitss(int
bus, int i2c_address)
Creates an adafruitss object
Parameters:
-----------
bus: Number of the used I2C bus
i2c_address: Address of the servo shield on the I2C bus
"""
this = _pyupm_adafruitss.new_adafruitss(bus, i2c_address)
try:
self.this.append(this)
except Exception:
self.this = this
[docs] def update(self):
"""int update(void) """
return _pyupm_adafruitss.adafruitss_update(self)
[docs] def setPWMFreq(self, freq):
"""
void
setPWMFreq(float freq)
Sets the frequency of the servos
Parameters:
-----------
freq: Frequency at which the servos operate
"""
return _pyupm_adafruitss.adafruitss_setPWMFreq(self, freq)
[docs] def servo(self, port, servo_type, degrees):
"""
void servo(uint8_t
port, uint8_t servo_type, float degrees)
Moves one of the servos to a specified angle
Parameters:
-----------
port: Port of the servo on the shield (servo number)
servo_type: Can be 0 = standard (1ms to 2ms), 1 = extended (0.6ms to
2.4ms), or 2 = extended (0.8ms to 2.2ms)
degrees: Angle to set the servo to
"""
return _pyupm_adafruitss.adafruitss_servo(self, port, servo_type, degrees)
__swig_destroy__ = _pyupm_adafruitss.delete_adafruitss
__del__ = lambda self: None
adafruitss_swigregister = _pyupm_adafruitss.adafruitss_swigregister
adafruitss_swigregister(adafruitss)
# This file is compatible with both classic and new-style classes.