1.驱动12x8点阵LED
这个ardiuno R4 WIFI版本是带点阵LED灯的,要驱动也很简单,
点阵的LED灯1代表亮灯,0代表熄灯。
使用ai生成的8*12点阵拿下来发现是乱码,只能自己手动改了。
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
void setup()
{
Serial.begin(115200);
matrix.begin();
}
uint8_t smile[8][12] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
uint8_t fish[8][02] = {
{ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 },
{ 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1 },
{ 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 },
{ 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1 },
{ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 },
{ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 }
};
void loop()
{
matrix.renderBitmap(smile, 8, 12);
delay(1000);
matrix.renderBitmap(fish, 8, 12);
delay(1000);
}
在ardiuno ide上面选中相同的字符会自动标记其他相同的字符,可以根据代码直接手动修改,如图所示,我手动画的小鱼