It took me a min to figure out how to feed this function the data it wanted but now I have it working for me Thanks for posting the code.
Nobody else on the net added the // Avoid div/zero line.
It took me a min to figure out how to feed this function the data it wanted but now I have it working for me Thanks for posting the code.
Nobody else on the net added the // Avoid div/zero line.
That may be due to the fact that AVR based Arduinos don't panic on a DIV/0 but ARM based systems do and I suggest to make defensive programming a habit.
Here is a better idea https://m.youtube.com/watch?v=PVj4k0R9s4E
For measuring voltage and current without volt dividers.