Hey folks,
when running on 5v with an analog stick, I get other values than on 3.3v. Question is, that I try to get the values on the serial monitor, when running on battery. Problem is, when I connect a usb cable to the board, I charge the battery and running then on 5 Volts. Is there a solution?
:-\
Greetings
Mainsedora
You need to do one of two things.
Either use a reference voltage of 3.3 and set your equations to use that as the base divider.
Or add a routine that detects the change from 3.3 to 5 volts and change the divider in the sketch based on that.
Preference would be the first option using the AREF pin as that will give you consistent readings regardless of change.
Also ensure your sensor is capable of 3.3 volt stable operation as a lot require 5 volts.
Another tutorial here for the calculations
You can find a lot of useful AREF material by using MKR1000 in your search terms as it is basically the same board with additional hardware. There are some notes to be aware of so please read up a little first especially when selecting internal vs external functions.