MicroPython DS3502 Driver

ds3502

MicroPython Driver for the DS3502 Potentiometer

All Code adapted for Micropython from: https://github.com/adafruit/Adafruit_CircuitPython_DS3502

  • Author(s): Bryan Siepert, Jose D. Montoya

class micropython_ds3502.ds3502.DS3502(i2c, address: int = 0x28)[source]

Driver for the DS3502 Sensor connected over I2C.

Parameters:
i2c : I2C

The I2C bus the DS3502 is connected to.

address : int

The I2C device address. Defaults to 0x28

Quickstart: Importing and using the device

Here is an example of using the DS3502 class. First you will need to import the libraries to use the sensor

from machine import Pin, I2C
from micropython_ds3502 import ds3502

Once this is done you can define your machine.I2C object and define your sensor object

i2c = I2C(1, sda=Pin(2), scl=Pin(3))
ds3502 = ds3502.DS3502(i2c)
set_default(default: int) None[source]

Sets the wiper’s default value and current value to the given value

Parameters:
default : int

The value from 0-127 to set as the wiper’s default.

property wiper : int

Potentiometer’s wiper value