B4R Question esp8266 nodemcu status battery and recharge

Erel

Administrator
Staff member
Licensed 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
 
Top