HI,
I'm having difficulty getting proper results when using digitalReadFast.
The attached program works fine with digitalRead, but when I switch (uncomment) digitalRead with digitalReadFast I get unpredictable results. ( No change to wiring or ports used )
I added the <digitalWriteFast.h> library and the results shown at the bottom show the difference between toggling the DigitalRead and digitalReadFast lines.
This original code is courtesy of Ryan Boland from.
The code was tested on an Arduino UNO using pins D2 and D3 connect to my Futaba RC Receiver. ( INT0 and INT1)
Things that I have tried to no avail:
- removed the EnableInterrupt.h and went back to attachinterrupts.
- tried a 10K resistor on the input pin.
- changed the digitalwrite and pinmode to the "Fast" version.
- changed the interrupt to RISING
- changed the pinmode to INPUT_PULLUP
I'm sure I'm just doing something dumb, but I would appreciate some guidance.
thanks Brian
Results with digitalRead: ( Looks Good, as expected )
CH1:1524 CH2:1536
CH1:1512 CH2:1524
CH1:1512 CH2:1520
CH1:1524 CH2:1536
CH1:1512 CH2:1524
Results with digitalReadFast:
CH1:64216 CH2:62692
CH1:9024 CH2:9032
CH1:6380 CH2:4856
CH1:16732 CH2:16724
CH1:14080 CH2:12556
CH1:24424 CH2:24432
CH1:21780 CH2:20264
DigitalReadTest.ino (1.33 KB)