I have pin 20 running as in input. I have input_pullup on, an opto isolator is buffering the input from the 12v signal
But instead of the interrupt only triggering when a signal is applied to the indicator input it triggers when the signal is being taken off too…
I have the interrupt set to trigger when the pin is falling as the opto pulls the pin to ground when a signal is applied.
Why is it doing this? its proving to be a total pain. I can program a way around it by avoiding using an interrupt and just read off pin value in a function but there are other inputs that are behaving the same. Is this a bug in the libmaple core?
I checked with a visual output and serial print. The pins values are showing correct, 0 or 1… So its not earth floating.
Any ideas?
Could you try using only one or the other too see if there is any difference?
One more thing, even if the pin is 5V tolerant, perhaps the pull up resistor to 5V is causing the issues with the interrupts?
Also, have you checked with an oscilloscope to make sure the signal is not bouncing up and down?
Other than those 2 things, may be worth checked the code in the core to confirm it doesn’t have a bug and is not setting the interrupt edge correctly.
The work around I have going is a one line if statement that sets a boolean to true or the previous value of the boolean. The boolean gets reset to false in another function when that function has finished its thing, this being the function the pin is meant to trigger…
Its a bit of a crappy way of doing it but it stops the strange state change effect of the pin.
Maybe it is noise… The noise being so fast the input state doesnt get printed out…. but is fast enough for the interrupt to trigger…
At the moment im just testing the inputs by applying 12v to the wires… Its not on the motorbike yet.
so if im to change the circuit diagram in the future version… I add a small cap between the pin and ground?
Maybe it is noise… The noise being so fast the input state doesnt get printed out…. but is fast enough for the interrupt to trigger…
At the moment im just testing the inputs by applying 12v to the wires… Its not on the motorbike yet.
so if im to change the circuit diagram in the future version… I add a small cap between the pin and ground?
It’s worth reading that thread as there are some simple schematics showing the resistors and capacitors
I’m building something similar to correct a vehicle speedo signal, I used this resource as a start point -> http://members.rennlist.com/tom86951/Sp … Page1.html
Different input circumstance however, floating to earth, but similar principal.
My project so far is here -> https://github.com/BennehBoy/ArduinoSpeedoCorrection

