-
• #2
Hi,
What does repeat: true do?
It means that it'll call the function more than once if the pin changes state more than once (after it's been debounced).
repeat:false
will only ever call the callback function once.I'm driving a relay via a FET with protection diode from Pico
I'd have to see the circuit... to me it sounds like something is wrong with the way the Pico is wired up, so that it is unable to pull the pin's voltage down to 0v (it can supply 20mA on a pin, but that's it).
To me, 2.43v looks close-ish to
3.3v - 0.7v
- so the voltage rail minus the diode voltage drop. Are you sure you didn't just put the diode in backwards?Also you shouldn't need to use
pinMode
at all - if you don't specify it,digitalWrite
/digitalRead
/etc will automatically change the pin state for you.Maybe try doing
digitalWrite(pin,0);
on a pin that isn't connected to anything and see what happens - it should go down to near enough 0v. -
• #3
Gordon thanks
I'm certain the diode is in the right way will replace it and see how I get on. Circuit diag attached.
1 Attachment
-
• #4
Hmm, sure looks fine. Although sometimes people put a resistor (10-100k?) from the gate to ground, just to stop the relay energising while the microcontroller boots and the IO pin is open circuit.
Could it be there is some issue with the FET?
Personally I'd try disconnecting B15 from the FET if at all possible (maybe remove the FET if you can't touch the Pico?) and make sure that pin B15 is moving between 0v and 3.3v as you'd expect.
Of course it could even be a short on the board, if one IO pin was 0v and the other was 3.3v it's possible that you'd end up with the voltage you got.
-
• #5
Thanks Gordon tried the pull down resistor but still not helped. Will try your other tips.
What does repeat: true do? repeat after debounce has expired?
I'm driving a relay via a FET with protection diode from Pico which energises when I run save() from the IDE or from power-on. Not what I want or expected
To fix it I add pinMode def to
What am I missing?