API Reference

qwiic_as6212

Python module for the [SparkFun Digital Temperature Sensor Breakout - AS6212 (Qwiic)](https://www.sparkfun.com/products/18521)

This python package is a port of the existing [SparkFun Qwiic AS6212 Sensor Arduino Library](https://github.com/sparkfun/SparkFun_TMP102_Arduino_Library/tree/master/examples)

This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)

New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).

class qwiic_as6212.QwiicAs6212Sensor(address=None, i2c_driver=None)[source]
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

The AS6212 Sensor device object.

Return type

Object

begin()[source]

Initialize the operation of the Soil Moisture Sensor module :return: Returns true of the initialization was successful, otherwise False. :rtype: bool

property connected

Determine if a Soil MoistureSensor device is conntected to the system.. :return: True if the device is connected, otherwise False. :rtype: bool

get_address()[source]

Returns the device address

get_alert_polarity()[source]

Get the polarity of Alert AS6212_ALERT_ACTIVE_HIGH (1) AS6212_ALERT_ACTIVE_LOW (0)

get_alert_status()[source]

Get the status of the alert bit (0 or 1)

get_consecutive_faults()[source]

Gets the number of consecutive faults that need to happen in a row before alert is changed. valid settings are 1,2,3 or 4 but this correspond to other bit values in the configuration register bits 11 and 12

get_conversion_cycletime()[source]

Gets the conversion cycle time (aka conversion rate) in teh config reg Returns the cycle time in milliseconds: (125/250/1000/4000)

get_interrupt_mode()[source]

Get the interrupt mode bit AS6212_MODE_COMPARATOR (0) AS6212_MODE_INTERRUPT (1)

get_single_shot_status()[source]

gets the status of the single shot bit from the config register 0 = No conversion ongoing / conversion finished 1 = Start single shot conversion / conversion ongoing

get_sleep_mode()[source]

gets the status of the sleep mode bit from the config register

is_connected()[source]

Determine if a Soil MoistureSensor device is conntected to the system.. :return: True if the device is connected, otherwise False. :rtype: bool

read_2_byte_register(register_to_read)[source]

Reads two bytes of data from a desired register. Combines them into a single 16 bit value Returns single value

read_high_temp_c()[source]

Gets T_HIGH (degrees C) alert threshold

read_high_temp_f()[source]

Reads T_HIGH register in F

read_low_temp_c()[source]

Gets T_LOW (degrees C) alert threshold

read_low_temp_f()[source]

Reads T_LOW register in F

read_temp_c()[source]

Reads the results from the sensor :rtype: integer

read_temp_f()[source]

Reads the results from the sensor :rtype: integer

set_alert_polarity(polarity)[source]

Set the polarity of Alert AS6212_ALERT_ACTIVE_HIGH (1) AS6212_ALERT_ACTIVE_LOW (0)

set_consecutive_faults(faults)[source]

Set the number of consecutive faults 1 - 1 fault 2 - 2 faults 3 - 3 faults 4 - 4 faults

set_conversion_cycletime(cycletime)[source]

sets the conversion cylce time (aka convertion rate) in the config register valid settings are:

AS6212_CONVERSION_CYCLE_TIME_125MS AS6212_CONVERSION_CYCLE_TIME_250MS AS6212_CONVERSION_CYCLE_TIME_1000MS AS6212_CONVERSION_CYCLE_TIME_4000MS

set_high_temp_c(temperature)[source]

Sets THIGH (degrees C) alert threshold

set_high_temp_f(temperature)[source]

Sets T_HIGH (degrees F) alert threshold

set_interrupt_mode(mode)[source]

sets the interrupt mode bits in the config register

valid options are: AS6212_MODE_COMPARATOR (0) AS6212_MODE_INTERRUPT (1)

set_low_temp_c(temperature)[source]

Sets T_LOW (degrees C) alert threshold

set_low_temp_f(temperature)[source]

Sets T_LOW (degrees F) alert threshold

set_sleep_mode(mode)[source]

sets the sleep mode bit (on or off) in the config register

valid options are: 0 = SLEEP MODE OFF 1 = SLEEP MODE ON

trigger_single_shot_conversion()[source]

Sets the SS mode bit in the config register Note, you must be in sleep mode for this to work