pdf-icon

Arduino Quick Start

2. Devices & Examples

6. Applications

Atom System Functions

begin

Description:

Clears the serial buffer, sets the serial baud rate to 115200; initializes I2C; initializes the LED matrix.

Syntax:

void begin(bool SerialEnable, bool I2CEnable, bool DisplayEnable);

Example:

cpp
1 2 3 4
#include "M5Atom.h" void setup(){ M5.begin(true, true, true); // Clears the serial buffer, sets the serial baud rate to 115200; initializes I2C; initializes the LED matrix. }

update

Description:

Reads the state of the button.

Syntax:

void update();

Example:

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "M5Atom.h" #include <M5Atom.h> void setup() { M5.begin(); } void loop() { M5.update(); // M5.update() is required to read the state of the button, see System for details. if (M5.Btn.isPressed()) { // If the button is pressed Serial.println("Button is pressed."); } delay(20); }