I am using PlatformIO to do some work with an Arduino Due board. Everything worked fine until I started using interrupts read from a quadrature decoder.
Due to keeping other parts of the program running, I have a delay() in my loop to count detections in a given time, with the interrupts being turned on just before the delay, and off just after.
This worked well using the Arduino IDE, but after I moved my project over to PlaftormIO (new laptop, and I work with several other platforms and wanted everything in one place), the following line is giving me some problems:
EIFR = bit (INTF0);
Apparently, neither EIFT and INTF0 are declared. I have included "Arduino.h" which I thought would (and indeed did in the IDE) declare these. How can I fix this?
Due to keeping other parts of the program running, I have a delay() in my loop to count detections in a given time, with the interrupts being turned on just before the delay, and off just after.
Please explain how the delay keeps other parts of the program running.
How can I fix this?
Why are you asking here? You should be asking on the PlatformIO forum.
PaulS:
Please explain how the delay keeps other parts of the program running.
The delay allows me to measure speed from the encoder during a set period, around which I can run the rest of my program. I turn the interrupts off outside the delay as the encoder will (could, but I must assume will) be turning at all times:
[Other operations]
Interrputs on
Delay
Interrupts off
[Other opertions]
Turning them on and off again without a delay would be stupid!