I would like to know if analogReadResolution(8); will work on Arduino nano.
When I remove the 8bit resolution line all works fine.
This is the error I get.
Arduino: 1.8.5 (Windows 10), Board: "Arduino Nano, ATmega328P"
C:\Users\mike\Desktop\Lcd 4 Wire\lcd4wire\lcd4wire.ino: In function 'void loop()':
lcd4wire:28: error: 'analogReadResolution' was not declared in this scope
analogReadResolution(8);
^
exit status 1
'analogReadResolution' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
analogReadResolution was added when boards with a >10 bit ADC were released. In order to maintain compatibility with existing code (which assumed 0~1023 output), they had to make it default to 10bit mode - however, to allow people to take advantage off the improved resolution if they were making a sketch that was only for boards with 12-bit ADCs, analogReadResolution was added to enable that.
The classic AVRs don't have a way to set the resolution - it comes out 10-bit, and if you want less than that, you right-shift it (meaning, you can't get faster ADC conversion by lowering resolution like I think you can on the newer boards)