基于ATOM的简易POV显示-Arduino中文社区 - Powered by Discuz! Archiver

vany5921 发表于 2020-4-21 11:09

基于ATOM的简易POV显示

1.器材选用
使用 LiPo 电池驱动 M5ATOM 矩阵,并在电机上转动。电机使用 PWM 控制器调整转速。





2.显示图像
M5ATOM 矩阵的 5 个 LED 以 RGBY 的四种颜色按顺序发射,在电机转速调整期间旋转,并确认可在1圈显示48个像素。



3.在 Excel 中生成图像数据
我们尝试了一种技术,在 Excel 中绘制点画,然后转换极坐标以生成数据。半径分为六个部分。 由于 M5ATOM Matrix LED 使用 5 个 LED,因此不使用第一个数据(中间像素)。

在 Excel 中转换方法如下:A为中心坐标

生成下图像文件
#define Frame 1
#define NUMPIXELS 6
#define Div 48

const uint32_t pic = {
{
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xffff00},
    {0x000000, 0xF7B95C, 0x000DEB, 0xff0000, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0xff0000, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xff0000, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xff0000, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0x000DEB, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000DEB, 0x000000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000000, 0x000000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000000, 0x000000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xF7B95C, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xF7B95C, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0xF7B95C, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000DEB, 0x000000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000DEB, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0xF7B95C, 0xF7B95C, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0xF7B95C, 0xF7B95C, 0xff0000},
    {0x000000, 0xF7B95C, 0xF7B95C, 0xF7B95C, 0x000000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0xF7B95C, 0xF7B95C, 0x000000},
    {0x000000, 0xF7B95C, 0x000DEB, 0xF7B95C, 0xF7B95C, 0x000000},
    {0x000000, 0x000DEB, 0x000DEB, 0xF7B95C, 0xF7B95C, 0x000000},
    {0x000000, 0x000DEB, 0x000DEB, 0xF7B95C, 0xF7B95C, 0xF7B95C},
    {0x000000, 0x000DEB, 0x000DEB, 0x000DEB, 0xF7B95C, 0xF7B95C},
    {0x000000, 0x000DEB, 0x000DEB, 0x000DEB, 0x000DEB, 0x000000},
    {0x000000, 0x000DEB, 0x000DEB, 0x000DEB, 0x000000, 0x000000},
    {0x000000, 0x000DEB, 0xF7B95C, 0xF7B95C, 0x000000, 0x000000},
    {0x000000, 0x000DEB, 0xF7B95C, 0xF7B95C, 0x000000, 0x000000},
    {0x000000, 0x000DEB, 0xF7B95C, 0x000000, 0x000000, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0x000000, 0x000000, 0x000DEB},
    {0x000000, 0xF7B95C, 0xF7B95C, 0x000000, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000000, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0x000DEB, 0x000DEB},
    {0x000000, 0xF7B95C, 0x000DEB, 0xff0000, 0xff0000, 0xff0000},
    {0x000000, 0xF7B95C, 0x000DEB, 0xff0000, 0xff0000, 0xffff00},
    {0x000000, 0xF7B95C, 0x000DEB, 0x000DEB, 0xff0000, 0xffff00},
},
};
根据生成的图像点亮LED
#include "FastLED.h"
#include "graphics.h"

#define NUM_LEDS 5
#define DATA_PIN 27
#define Bright 30

int FrameNum = 0,Num = 0;

CRGB leds;

int rotDivNum = 0;

void setup(){
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(Bright);
}

void loop(){
for(int i=1; i<NUMPIXELS; i++) {
    leds = pic;
}
FastLED.show();

rotDivNum++;
if(rotDivNum >= Div){
    rotDivNum = 0;
    FrameNum++;
    if(FrameNum >= 4){
      FrameNum = 0;
      Num++;
      if(Num >= Frame) Num = 0;
    }
}
}
页: [1]
查看完整版本: 基于ATOM的简易POV显示