The power meter was disassembled and the Elegoo UNO board was removed and replaced by an R4 Minima board. Does my original software for the UNO compile with no errors? Of course not, we have to deal with some issues now.
First, the new R4 Minima board can have up to 14 bit analog resolution as opposed to the UNO's 10 bit resolution. You can also have 12 bit resolution if you choose, so I chose that for now with the statement -
analogReadResolution(12); //change to 12-bit resolution: 4095
Next, I was using the external analog reference so I could have 3.3 V for better resolution than 5 V would have. However a minor error needed to be corrected.
old statement: analogReference(EXTERNAL);
new statement: analogReference(AR_EXTERNAL);
That fixed that problem. However more issues were causing the rotary encoder and it's button to not function. I used two libraries for these in the original program that now would not compile.
The Uno board had two easily accessible interrupt pins available, 2 & 3, being used for the rotary encoder. But to add a 3rd interrupt (easily) I used another library "PinChangeInterrupt". I needed this for the ISR for the button. This also was not working but should not now be needed.
The R4 board has more interrupts available now without the need for this helper library. I don't think the official Arduino spec pages are correct for this new board yet because they say the R4 Minima only has 2 & 3 easily available, but from other research I did it looked like pins 0, 1, 2, 3, 8, 12, 13, 15, 16, 17, 18 and 19 were easily available for interrupts.
I changed the interrupt I was using from pin 5 to pin 8, moved one wire, and presto the encoder button now works.
The Library used for the rotary encoder, "Encoder" now does not work with this board. The compiler spews error messages for it. That used interrupt pins 2 & 3.
For now, with this non-functional library and associated ISR routine commented out, my software compiles, i.e. the display works, the encoder button works, and the power reads OK from my hp 437B 0 dBm reference, although it's a little off because I can't select 50 MHz with the encoder knob. Yes the button does seem to respond a lot faster.
I will look at solutions for the encoder function next - there are other encoder libraries available that may be updated for this board.