I have a photodiode connected to an ads1015 and would like to have the alert pin signal on every transition of the threshold value (low to high.
Somehow I cannot get it working using roberthh's ads1x15.py driver. Pin 12 is connected to the ads1015 alert pin
Test code: the photodiode is measuring a flashing LED with values low =550 high =650
Code: Select all
from machine import I2C, Pin, Timer
from ads1x15 import ADS1015
import urequests
import utime
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
adc = ADS1015(i2c, 72, 3)
adc.alert_start(4, 0, threshold=600)
elapsed = 0.0
alert = Pin(12, Pin.IN)
def pulse(p):
print('Pulse')
alert.irq(trigger=Pin.IRQ_FALLING, handler=pulse)