I changed the straight line voltage get code into a function so I can call it will multiple an analog pin number as a variable. Next is to do turn the current gathering code into a function. This also offers flexibility to have some other chipset get the current and voltage and and all I need to do is fix the called code.
Calling code.
float voltage=get_voltage(A5); /get volatge on A5
Called code.
float get_voltage ( int vpin ) {
float gvolt=(analogRead(vpin)/4.092)/10;
return gvolt;
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.