I have been an arduino convert for quite some time now, and have successfully completed several projects which are now integrated into my daily life.
However this one has stumped me. I'm afraid I don't have any code yet, because this is fairly intrinsic to my aim.
I am creating a voltage monitoring circuit to enable me to safely use LiPo batteries to power an eBike. As you probably know, over-discharge, over-charge, or un-balanced discharge are a very quick way to kill a lithium battery, and possibly anyone close by.
I am using 6-cell LiPos, and want to measure the voltage of every cell, individually. I already have the circuit worked out and the PCB designed and ready to etch.
Part of my code will require the measurement and comparison of each of the 6 values - I am using one analogue pin for each cell.
I need to determine the maximum value of the 6 inputs, and the minimum value of the 6 inputs, in order to determine what the difference is between them, and cut the power if the difference is above a preset level.
I've tried 'max(x, y)' but apparently this is wrong as it can only accept 2 variables. I'm pretty sure it will be a case of 'let me google that for you', but I must be googling the wrong thing!
Many thanks in advance,