Well I wanted the battery level in mV not V. As I said, the number 45.6 was for a 10 bit A-D conversion so for ROBOTC with 12 bit A-D the number would be 4 times larger, 45.6 x 4 = 182.4 so
V = AnalogValue / 182.4
but I want mV so
mV = AnalogValue / 182.4 * 1000
1000 / 182.4 = 5.48
Now having said that if you use 182.4 then you will get an even smaller value, so there are two possible explanations.
You have something connected wrong, you should have analog input 1 connected to the status port on the power converter. 4.8 x 45.6 gives an analog value of 219, this feels like you are reading an unconnected analog input as it is about the value of a floating input. Does the value on analog in1 change when you connect and disconnect the power expander battery?
There is a theory that there are two versions of power converter, I know the one I have is an older model, it has an issue that when the status port is connected then the led flashes red indicating an error even when there is not one. If there is indeed a new model then the calibration may have changed and different numbers needed, I have not been able to test this as the new unit I ordered is still on backorder.
Thank you for the reply; I will test out the new conversion tonight and respond back with results.
As for the 4.8 number, it does fluctuate when the arm and only the arm is being moved (which are the 4 motors in the expander) and I do believe it went to 0 when the battery was removed, but I am not fully certain of this. I’ll respond back later today.
Okay, so after testing, it actually gives a value of 48.[something] normally. Multiplying by 5.48 gives me 118[something]. However, I am certain this is tied to the battery because it fluctuates whenever the arm is moved.
(sorry I don’t have the [something]s for you; I shorten the number to a 3 character string so I can view the battery, the power expander battery, and the backup batter voltage in one line on the LCD)