Guys and gals
The help you gave me with my previous query was priceless. I thank you all.
In the original sketch, I was using 2 ADC ports to read 2 voltages and then compare them. That now works a treat.
As I expect to expand the system, I will have insufficient ADC ports, so I decided to look to use the inbuilt comparator, thus freeing up 2 ADC ports.
Checking out the Forum, I came across a library file, analogCom.h, by leo72, written back in 2013. Has anyone had experience of this library as I cannot get it to compile correctly. One of the commands, analogComparator.waitComp (), has the analogComparator part recognised, but the .write stays black in colour.
Has anyone else had any experience with this library, and been successful?
I got over this by another code snippet I found, written by Anthony Fremont (afremont), also in 2013, which set the ACSR and read the ACO bit. Making a couple of changes to it got it working just how I would like it. Also gave me some insight into this esoteric part of programming. :-))