Function:
Initialize the LED matrix
Syntax:
void begin()
Pay attention:
1.If you do not want to initialize LED with M5.begin (), call this Function before using LED
Example:
#include <M5Atom.h>
void setup() {
M5.Lcd.begin(); //Initialize Atom LED latticeM5.Lcd.begin (); / / Initialize Atom LED lattice.
}
void loop() {
}
Function:
Set the brightness of the illuminated LED.
Syntax:
void setBrightness(uint8_t brightness)
Example:
#include "M5Atom.h"
void setup(){
M5.begin(true, false, true); //Initialize M5Atom.
}
void loop(){
M5.dis.fillpix(0xffffff); //Illuminate the entire LED lattice with RBG color 0xffffff.
M5.dis.setBrightness(10); //Set the brightness of the illuminated LED
delay(1000);
M5.dis.fillpix(0xFFFF00);
M5.dis.setBrightness(100);
delay(1000);
}
Function:
Set the width and height of the pattern
Syntax:
void setBrightness(uint8_t brightness)
Function:
Start playing LED display
Syntax:
void run()
Pay attention:
1.If you do not want to initialize LED with M5.begin () and you want to use animation (), call this Function before using animation ()
Example:
#include <M5Atom.h>
void setup() {
M5.Lcd.begin(); //Initialize Atom LED lattice.
M5.Lcd.run();
}
void loop() {
}
Function:
Move a pattern in a specified direction at a specified speed
Syntax:
void animation(uint8_t *buffptr, uint8_t amspeed, uint8_t ammode, int64_t amcount)
Parameter | Type | Description |
---|---|---|
buffptr | uint8_t * | Pattern. |
amspeed | uint8_t | Moving speed (0,255). |
ammode | uint8_t | Moving direction. |
amcount | int64_t | Number of moving steps |
Move direction:
Constant | Value | Description |
---|---|---|
kMoveRight | 0x01 | Move the image to the right |
kMoveLeft | 0x02 | Move the image to the left |
kMoveTop | 0x04 | Move the image to the top |
kMoveButtom | 0x08 | Move the image to the buttom |
Example:
#include "M5Atom.h"
extern const unsigned char AtomImageData[375 + 2]; //External reference stores the array of images shown (click image.c below to download and save to the same directory as .ino).
void setup(){
M5.begin(true, false, true); //Clear the serial buffer and set the serial baud rate to 115200; initialize the LED matrix.
delay(50);
}
void loop(){
//Move a pattern AtomImageData 25 steps in the specified direction kMoveLeft at a specified speed of 200
M5.dis.animation((uint8_t *)AtomImageData, 200, LED_DisPlay::kMoveLeft, 25);
delay(5250);
}
Pay attention:
1.
image.c Picture download
Function:
Get whether the pattern is in motion
Syntax:
boolean animationrunning()
Function return value
Value | Description |
---|---|
true | running |
false | static |
Function:
Move the displayed content in a certain direction.
Syntax:
void displaybuff(uint8_t *buffptr, int8_t offsetx = 0, int8_t offsety = 0)
Pay attention:
1.x > 0 move to the right, y > 0 move down
Parameter | Type | Description |
---|---|---|
buffptr | uint8_t * | Array of pattern storage. |
offsetx | int8_t | The number of grids moving in the x direction. |
offsety | int8_t | The number of lattices moving in the y direction |
Example:
#include "M5Atom.h"
extern const unsigned char AtomImageData[375 + 2]; //Click on the top image.c to download the array
void setup(){
M5.begin(true, false, true);
delay(50);
}
void loop(){
M5.dis.displaybuff((uint8_t *)AtomImageData,-2, 0); //Move the pattern 2 squares to the left
delay(100);
}
Function:
Lights a LED (Number: 0mm 24) (Atom-Lite has only one light) in a specified RGB color.
Light the lamp LED at the coordinates of (xpene y) with the specified RGB color
Syntax:
void drawpix(uint8_t xpos, uint8_t ypos, CRGB Color)
void drawpix(uint8_t Number, CRGB Color)
Parameter | Type | Description |
---|---|---|
xpos | uint8_t | X coordinate (0,5). |
ypos | uint8_t | Y coordinates (0,5). |
Number | uint8_t | Light the * th lamp (0~24). |
Color | CRGB | The color of the lamp |
Example:
#include "M5Atom.h"
void setup(){
M5.begin(true, false, true); //Initialize M5Atom.
delay(50); //Delayed 50ms.
M5.dis.drawpix(0, 0xBBFFFF); //Light the 0th LED with RBG color 0xBBFFFF.
//M5.dis.drawpix(0,0, 0xBBFFFF); //Illuminate the LED at (0meme0) with RBG color 0xBBFFFF
}
void loop(){
}
Pay attention:
1.
Download RGB conversion tool
Function:
Fill a RBG color into the entire LED lattice.
Syntax:
void fillpix(CRGB Color)
Example:
#include "M5Atom.h"
void setup(){
M5.begin(true, false, true); //Initialize M5Atom.
}
void loop(){
M5.dis.fillpix(0xffffff); //Illuminate the entire LED lattice with RBG color 0xffffff
}
Function:
Extinguish all lit LED
Syntax:
void clear()
Example:
#include "M5Atom.h"
void setup(){
M5.begin(true, false, true); //Initialize M5Stack.
delay(50); //Delayed 50ms.
M5.dis.drawpix(0, 0xBBFFFF);
//M5.dis.drawpix(0,0, 0xBBFFFF);
}
void loop(){
M5.update(); //Read button press state.
if (M5.Btn.wasPressed()){
M5.dis.clear(); //Extinguish all lit LED.
}
}