Hello, I’m going to make a motion with JETSON nano, adafruit’s ADS1115, and buttons.
The code is as follows.
import RPi.GPIO as gpio
import busio
import board
import time
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
SW3=36
i2c=busio.I2C(board.SCL, board.SDA)
ads=ADS.ADS1115(i2c, address=0x48)
gpio.setmode(gpio.BOARD)
gpio.setup(SW3,gpio.IN)
chan1 = AnalogIn(ads, ADS.P0)
chan2=AnalogIn(ads, ADS.P3)
while 1:
if gpio.input(SW3):
print(chan1.value, chan1.voltage)
else : print(chan2.value, chan2.voltage)
The following error occurs when trying to execute the code
‘ValueError: A different mode has already been set!’
RPI without using “import board” to eliminate errors.If there is an I2C provided by GPIO, I would like to use it, but RPI.Is there any I2C keyword provided by GPIO?
please check this kernel documentation, it also shows the paragraph to demonstrate the bindings. $L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/kernel/kernel-4.9/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt