start
This commit is contained in:
18
test.py
Normal file
18
test.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import time
|
||||
import board
|
||||
import busio
|
||||
import adafruit_ads1x15.ads1115 as ADS
|
||||
from adafruit_ads1x15.analog_in import AnalogIn
|
||||
|
||||
|
||||
i2c = busio.I2C(board.SCL, board.SDA)
|
||||
|
||||
# Create the ADS object and specify the gain
|
||||
ads = ADS.ADS1115(i2c)
|
||||
ads.gain = 1
|
||||
chan = AnalogIn(ads, ADS.P0)
|
||||
|
||||
# Continuously print the values
|
||||
while True:
|
||||
print(f"MQ-135 Voltage: {chan.voltage}V")
|
||||
time.sleep(1)
|
||||
Reference in New Issue
Block a user