B4R Question esp8266 nodemcu status battery and recharge

paul fredrick

Member
Licensed User
Longtime User
how to read status battery charge ?
and is possible recharge a battery connected with pin VIN whitout disconnected ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Read: https://www.reddit.com/r/esp8266/comments/9ubypi/how_do_i_use_the_espgetvcc_correctly/

B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private Timer1 As Timer
   Private VCC As UInt 'ignore
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   Timer1.Initialize("Timer1_Tick", 1000)
   Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick
   RunNative("GetVCC", Null)
   Log(VCC)
End Sub

#if C
 ADC_MODE(ADC_VCC);
void GetVCC (B4R::Object* o) {
   b4r_main::_vcc = ESP.getVcc();
}
#End if
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…