B4R Question esp8266 nodemcu status battery and recharge

Discussion in 'B4R Questions' started by paul fredrick, Apr 10, 2019.

  1. paul fredrick

    paul fredrick Member Licensed User

    how to read status battery charge ?
    and is possible recharge a battery connected with pin VIN whitout disconnected ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    How is the battery connected to the MCU?
     
  3. paul fredrick

    paul fredrick Member Licensed User

    with pin VIN (+) and gnd (-)
    but if necessary to receive data i can connect with micro usb
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Read: https://www.reddit.com/r/esp8266/comments/9ubypi/how_do_i_use_the_espgetvcc_correctly/

    Code:
    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
     
  5. paul fredrick

    paul fredrick Member Licensed User

    you are great !!!
     
  6. MikeSW17

    MikeSW17 Member

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice