pdf-icon

Arduino Guide

Battery

CoreInk battery status reading related API and case programs.

Example

#include "M5Unified.h"

void setup()
{
    auto cfg = M5.config();
    M5.begin(cfg);
    M5.Display.setTextDatum(middle_center);
    M5.Display.setTextFont(&fonts::Orbitron_Light_24);
    M5.Display.setTextSize(1);
}

void loop()
{
    M5.Display.clear();
    int vol = M5.Power.getBatteryVoltage();
    M5.Display.setCursor(0, 30);
    M5.Display.printf("BAT: %dmv", vol);
    delay(5000);
}

API

The power part of CoreInk uses the Power_Class in the M5Unified library. For more related APIs, you can refer to the document below:

On This Page