Freehawk
Full Member level 2
I don't know for sure this is the right place to ask this question
I not, lead me into the right direction
I try to make digital pot work with Itsybitsy.
This is the datasheet of the AD5254
I based myself on the following document https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/i2c-devices
I can scan the devices (1 with adres 0x2c) (that seems correct)
But i can't find out how to set pot 1 to a value
AD5254 connections
This is the code i use
I get this result in serial window
Anyone any ideas? Please help me out
I not, lead me into the right direction
I try to make digital pot work with Itsybitsy.
This is the datasheet of the AD5254
I based myself on the following document https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/i2c-devices
I can scan the devices (1 with adres 0x2c) (that seems correct)
But i can't find out how to set pot 1 to a value
AD5254 connections
- pin 5 (wp) to VCC
- pin 9 (SDA) to SDA on itsibtsy (with 2.2k pull up resistor to 5v)
- pin10 to GND,
- pin 14 (scl) to SCL (with 2.2k pull up resistor to 5v)
- pin 15 to GND,
- pin 20 to VCC, (5v)
- pin 4 (AD0) do D10 itsibisy (this to be able to set AD0=0)
- pin 16 (AD1) to D11 itsibisy (this to be able to set AD1=0) just to be sure of the slave adress
This is the code i use
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 import busio import board from digitalio import DigitalInOut, Direction, Pull i2c = busio.I2C(board.SCL, board.SDA) i2c.unlock() ad1 = DigitalInOut(board.D11) ad2 = DigitalInOut(board.D10) ad1.switch_to_output(False) # Zet AD1 op 0 ad2.switch_to_output(False) # AD0 while not i2c.try_lock(): pass list = [(x) for x in i2c.scan()] hexlist=[hex(x) for x in list] print('device-list : ', list, hexlist) buf = bytearray(2) i2c.readfrom_into(list[0], buf) print(buf) i2c.writeto(list[0], b'0x0', stop=False) i2c.readfrom_into(list[0], buf) print('1 :', buf) i2c.writeto(list[0], b'0x10', stop=True) i2c.unlock()
I get this result in serial window
device-list : [44] ['0x2c']
bytearray(b'\xff\xff')
1 : bytearray(b'\xff\xff')
Anyone any ideas? Please help me out