Data sheet - http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf
Python code for controlling this with SPI
import time import spidev import RPi.GPIO as gpio gpio.setmode(gpio.BCM) gpio.setup(4,gpio.OUT) #if you need to open circuit #gpio.output(4, gpio.LOW) # Open circuit #gpio.output(4, gpio.HIGH) # Closed circuit, resistor working bus = 0 device = 0 spi = spidev.SpiDev() spi.open(bus, device) spi.max_speed_hz = 500000 spi.mode = 0 # try 0 that will set resistance to the min value res = input("value?") x = spi.xfer2([19,res]) print(x)
No comments:
Post a Comment