#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.begin(); M5.Lcd.setRotation(3);} void loop() { M5.Lcd.fillScreen(BLACK); M5.Lcd.setCursor(0, 0, 1); M5.Lcd.printf("AXP Temp: %.1fC \r\n", M5.Axp.GetTempInAXP192()); M5.Lcd.printf("Bat:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetBatVoltage(), M5.Axp.GetBatCurrent()); M5.Lcd.printf("USB:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetVBusVoltage(), M5.Axp.GetVBusCurrent()); M5.Lcd.printf("5V-In:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetVinVoltage(), M5.Axp.GetVinCurrent()); M5.Lcd.printf("Bat power %.3fmw", M5.Axp.GetBatPower()); M5.update(); delay(100);}
函数原型:
void begin(void);
功能说明:
传入参数:
返回值:
案例程序:
#include <M5StickC.h> void setup() { M5.begin();}void loop() {}
函数原型:
void PowerOff();
功能说明:
传入参数:
返回值:
案例程序:
#include <M5StickC.h> void setup() { M5.begin(); M5.lcd.fillScreen(GREEN); delay(3000); M5.Axp.PowerOff();} void loop() {}
函数原型:
void ScreenBreath(uint8_t brightness);
功能说明:
传入参数:
返回值:
案例程序:
#include <M5StickC.h> uint8_t i = 0; void setup() { M5.begin(); // By default, "M5.begin()" will initialize AXP192 chip M5.Lcd.printf("Hello, M5Stack!!");}void loop() { M5.Axp.ScreenBreath(i++); if (i > 100) i = 0; delay(10);}
函数原型:
void ScreenSwitch(bool state);
功能说明:
传入参数:
返回值:
案例程序:
#include <M5StickC.h> uint8_t i = 0; void setup() { M5.begin(); M5.Lcd.fillScreen(BLUE);}void loop() { M5.Axp.ScreenSwitch(true); delay(1000); M5.Axp.ScreenSwitch(false); delay(1000);}
函数原型:
bool GetBatState();
功能说明:
传入参数:
返回值:
函数原型:
float GetBatVoltage();
功能说明:
传入参数:
返回值:
函数原型:
float GetBatCurrent();
功能说明:
传入参数:
返回值:
函数原型:
float GetVinVoltage();
功能说明:
传入参数:
返回值:
函数原型:
float GetVinCurrent();
功能说明:
传入参数:
返回值:
函数原型:
float GetVBusVoltage();
功能说明:
传入参数:
返回值:
函数原型:
float GetVBusCurrent();
功能说明:
传入参数:
返回值:
函数原型:
float GetTempInAXP192();
功能说明:
传入参数:
返回值:
函数原型:
float GetBatPower();
功能说明:
传入参数:
返回值: