High GPIO Pins
-
Hi
Excuse my ignorance here, but what triggers the idea that a pin is "RISING". I have the following simple code:charger_input_detect=Pin('P14', mode=Pin.IN, pull=Pin.PULL_DOWN)
charger=0def pin_handler_rising(arg):
charger=1charger_input_detect.callback(Pin.IRQ_RISING, pin_handler_rising)
All I want to do is know if the LiPo battery is DONE. I have an output pin which will output Max 2.5V (Im paranoid about putting more than 3.3V on the pin and wrecking it). I figured this code would trigger the interrupt if it sees the put change from its default 0 value (low) to any value. I wouldnt have thought the actual end value would matter too much (within reason).
Should this actually work do you think?
Appreciate your feedback in advance :)
-
@bradnz So you want to tell, if the voltage of the LiPo battery is above 2.5 V. That should be done using the ADC, for various reasons.
a) The value at which a digital input switches from HIGH to LOW is not well defined and not stable. It is somewhere between 0.75 * Vdd and 0.25 * Vdd
b) You have to check the value of the variable charger anyhow, so instead of doing that you could also read an ADC value. If you want to have that done in an interrupt fashion, you can set-up a timer interrup which reads the ADC,