Hello!
I read 4 pages back of topics and I don't find any discussion on the point. Sorry if I miss it.
Is there any sw/lib solution already out? Or should I connect one analogue pin to Vin via resistor to avoid to damage the input of this analogue pin?
Thx
You should read the five volt pin of the MKR1000, not the Vin. There is only 5 volts on the pin when a usb is plugged in.
ok thx dy3dy3dy3
I'll do that. Since I don't see any other help I presume noway via anylib...
Hello,
What is the correct way to read the 5V pin via sw?
Thanks for help
@sturla_78
Via a simple voltage divider calculated for 5 volts (google voltage divider)
You would simply need to set an upper and lower limit and when one is reached branch your sketch to another function.
EG. sudo code.
If volts = 3.5 then warning.
Check the Analog read serial example for a basis on which to work.
Thanks again ballscrewbob,
May be that i have understood. I can read 5V pin divide by a voltage divider (the voltage must be minor of 3.3 for not damage mkr) for example if the final division is 2.5:
If volt > 2.2 usb connected
If volt < 2.2 battery connected
Could work this logic?
Thanks
Yes 3.3 volts !
That was a mistake on my part glad you spotted it phew.