pdf-icon

Arduino Quick Start

2. Devices & Examples

6. Applications

StickC System Functions

begin()

Description:

Initializes the LCD; initializes the power management chip AXP192; clears the serial buffer, and sets the serial baud rate to 115200.

Syntax:

void begin(bool LCDEnable=true, bool PowerEnable=true, bool SerialEnable=true)

Function Implementation:

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
void M5StickC::begin(bool LCDEnable, bool PowerEnable, bool SerialEnable){ //! Correct init once if (isInited) return; else isInited = true; //! UART if (SerialEnable) { Serial.begin(115200); Serial.flush(); delay(50); Serial.print("M5StickC initializing..."); } // Power if (PowerEnable) { Axp.begin(); } // LCD INIT if (LCDEnable) { Lcd.begin(); } if (SerialEnable) { Serial.println("OK"); } }

Example:

cpp
1 2 3 4 5
#include <M5StickC.h> void setup() { M5.begin(); }

GetBm8563Time()

This is an API function for the BM8563 chip. This chip communicates with the ESP32 via I2C, with an I2C address of 0x51.

Description:

Retrieves the current hour, minute, and second values, and saves them in M5.Rtc.Hour, M5.Rtc.Minute, and M5.Rtc.Second, in ASCII format.

Syntax:

void GetBm8563Time(void)

Example:

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.setRotation(3); M5.Lcd.setTextSize(2); M5.Lcd.fillScreen(BLACK); M5.Lcd.println("rtc test"); } void loop() { M5.Rtc.GetBm8563Time(); M5.Lcd.setCursor(0, 30, 2); M5.Lcd.printf("%02d:%02d:%02d/n",M5.Rtc.Hour, M5.Rtc.Minute, M5.Rtc.Second); delay(1000); }
On This Page