In platform.h, change GPIO_PIN_BATTERY from 15 to 8.
Putting a BJT inline with your circuit will cause some saturation voltage drop, up to about .2v depending on your BJT. This will affect you measurement. Additionally, your measurement may be slightly skewed by possible lower-than-ideal impedance on the ADC input (reported by one other customer).
Making this circuit viable will come down to tuning your voltage divider so that the measurement is accurate. Using these fixed values may give you some skewed readings.
I changed this and it did not work. The battery level stayed the same as before.
If I make changes in blebat.c, how would I apply them to hello_sensor.c?
do I have to build the file etc after I am the changes?
What every changes I make to this file do not seem to happen when I upload the program to my board
Apologies for the delay.
Going through the source code the, the battery monitoring code is actually hard coded to only monitor the battery input pin. That's the reason it's not working with a simple switch of the GPIO number.
This cannot be changed/worked around at the moment, but it could potentially be provided as a patch in future SDKs.
I am at the stage of ordering a final board for this project.
This is the last hurdle at the moment. Could you tell me when could I expect a patch to fix this?
Is there any other way around it?
Could I do my ADC read on my own battery monitoring pin and pass the result to the piece of code that actually sends the value of the battery? The value of the battery must be stored in some variable before it is sent.