A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.sparkfun.com/piservohat_py/classpi__servo__hat_1_1_pi_servo_hat.html below:

PiServoHat_Py: pi_servo_hat.PiServoHat Class Reference

SparkFun PiServoHat Initialise the qwiic_pca9685 python module at address with i2c_driver. More...

def  __init__ (self, address=None, debug=None, min_pt=1, max_pt=2)   This method initializes the class object. More...
  def  is_connected (self)   Is an I2C connection established with the device? More...
  def  restart (self)   Soft resets the chip and then clears the MODE1 register to restart the PWM functionality. More...
  def  get_pwm_frequency (self)   Reads the PWM frequency used on outputs. More...
  def  set_pwm_frequency (self, frequency=None)   Configures the PWM frequency used on outputs. More...
  def  get_pulse_time (self)   Reads and returns the current min and max pulse times for servo movement. More...
  def  set_pulse_time (self, min_pulse_time, max_pulse_time)   Updates the minimum and maximum pulse widths for the servos. More...
  def  move_servo_position (self, channel, position, swing=None)   Moves servo to specified location in degrees. More...
  def  set_duty_cycle (self, channel, duty_cycle)   Moves servo to specified location based on duty-cycle. More...
  def  get_servo_position (self, channel, swing=None)   Reads the specified location for the servo in degrees. More...
  def  sleep (self)   Set the SLEEP bit to 1, which will unpower the servos. More...
  def  wake (self)   Set the SLEEP bit to 0, which will power the servos. More...
 

SparkFun PiServoHat Initialise the qwiic_pca9685 python module at address with i2c_driver.

Parameters
address The I2C address to use for the device. If not provided, the default address is used. i2c_driver An existing i2c driver object. If not provided a driver object is created.
Returns
Bool Constructor Initialization True- Successful False- Issue loading I2C driver
◆ __init__() def pi_servo_hat.PiServoHat.__init__ (   self,   address = None,   debug = None,   min_pt = 1,   max_pt = 2  )

This method initializes the class object.

If no 'address' or 'i2c_driver' are inputed or 'None' is specified, the method will use the defaults.

Parameters
address The I2C address to use for the device. If not provided, the method will default to the first address in the 'available_addresses' list. Default = 0x40 debug Designated whether or not to print debug statements. 0- Don't print debug statements 1- Print debug statements min_pt The minimum pulse time of the servos in milliseconds. If not provided, default to 1 ms max_pt The maximum pulse time of the servos in milliseconds. If not provided, default to 2 ms
◆ get_pulse_time() def pi_servo_hat.PiServoHat.get_pulse_time (   self )

Reads and returns the current min and max pulse times for servo movement.

Returns: tuple: The minimum and maximum pulse times in milliseconds

◆ get_pwm_frequency() def pi_servo_hat.PiServoHat.get_pwm_frequency (   self )

Reads the PWM frequency used on outputs.

50 Hz is recommended for most servos.

Returns
Integer PWM Frequency Range: 24 Hz to 1526 Hz
◆ get_servo_position() def pi_servo_hat.PiServoHat.get_servo_position (   self,   channel,   swing = None  )

Reads the specified location for the servo in degrees.

Parameters
channel Channel of Servo to Control Range: 0 to 15 swing Range of Servo Movement 90- 90 Degree Servo 180- 180 Degree Servo
Returns
Float Esitmated Position (Degrees)
◆ is_connected() def pi_servo_hat.PiServoHat.is_connected (   self )

Is an I2C connection established with the device?

Returns
Bool Device Connection Status True- Connected False- Not Connected
◆ move_servo_position() def pi_servo_hat.PiServoHat.move_servo_position (   self,   channel,   position,   swing = None  )

Moves servo to specified location in degrees.

Parameters
channel Channel of Servo to Control Range: 0 to 15 position Position (Degrees) Range: Open, but should between 0 and specified servo 'swing'. The range is not regulated because most servos have extra room for play (i.e. a 90 degree servo may have a +120 degree usable swing). If 'None' is specified, the default setting is 90 degrees. swing Range of Servo Movement 90- 90 Degree Servo 180- 180 Degree Servo
◆ restart() def pi_servo_hat.PiServoHat.restart (   self )

Soft resets the chip and then clears the MODE1 register to restart the PWM functionality.

The PWM frequency is returned to the default 50 Hz setting.

◆ set_duty_cycle() def pi_servo_hat.PiServoHat.set_duty_cycle (   self,   channel,   duty_cycle  )

Moves servo to specified location based on duty-cycle.

Parameters
channel Channel of Servo to Control Range: 0 to 15 duty_cycle Duty-Cycle (Percentage) Float Range: 0 to 100 (%) Resolution: 1/4096
◆ set_pulse_time() def pi_servo_hat.PiServoHat.set_pulse_time (   self,   min_pulse_time,   max_pulse_time  )

Updates the minimum and maximum pulse widths for the servos.

Args: min_pulse_time (float): The new minimum pulse width in ms max_pulse_time (float): The new maximum pulse width in ms

Returns: bool: Returns true if update was successful, false if an error was encountered

◆ set_pwm_frequency() def pi_servo_hat.PiServoHat.set_pwm_frequency (   self,   frequency = None  )

Configures the PWM frequency used on outputs.

50 Hz is the default and recommended for most servos.

Parameters
frequency PWM Frequency Range: 24 Hz to 1526 Hz
Returns
Bool Function Operation True- Successful False- Issue in Execution

NOTE: Changing PWM frequency affects timing for servo positioning. Additionally, the servo position needs to be reset for the output control (on all channels). The output on all channels is initially turned off after the frequency change, but is re-enabled after any of the channels is reconfigured. However, the new PWM frequency will be in affect, so the timing of the outputs on the other channels will be off. (i.e. if a PWM frequency is doubled; the timing of that signal may be halfed.)

◆ sleep() def pi_servo_hat.PiServoHat.sleep (   self )

Set the SLEEP bit to 1, which will unpower the servos.

This preserves the life of the servos.

◆ wake() def pi_servo_hat.PiServoHat.wake (   self )

Set the SLEEP bit to 0, which will power the servos.

◆ acAddr int pi_servo_hat.PiServoHat.acAddr = 0x70 static ◆ address pi_servo_hat.PiServoHat.address ◆ available_addresses pi_servo_hat.PiServoHat.available_addresses = _AVAILABLE_I2C_ADDRESS static ◆ available_pwm_channels pi_servo_hat.PiServoHat.available_pwm_channels ◆ debug pi_servo_hat.PiServoHat.debug ◆ device_name pi_servo_hat.PiServoHat.device_name = _DEFAULT_NAME static ◆ frequency pi_servo_hat.PiServoHat.frequency = _DEFAULT_SERVO_FREQUENCY static ◆ gcAddr int pi_servo_hat.PiServoHat.gcAddr = 0x00 static ◆ maximum_pulse_width pi_servo_hat.PiServoHat.maximum_pulse_width ◆ minimum_pulse_width pi_servo_hat.PiServoHat.minimum_pulse_width ◆ PCA9685 pi_servo_hat.PiServoHat.PCA9685 ◆ subAddr_1 int pi_servo_hat.PiServoHat.subAddr_1 = 0x71 static ◆ subAddr_2 int pi_servo_hat.PiServoHat.subAddr_2 = 0x72 static ◆ subAddr_3 int pi_servo_hat.PiServoHat.subAddr_3 = 0x74 static

The documentation for this class was generated from the following file:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4