上python代码!
/*!
* MindPlus
* mpython
*
*/
#include <MPython.h>
#include <DFRobot_NeoPixel.h>
// 函数声明
void DF_ChuShiHua();
void DF_RGB();
void DF_ZhuYe();
// 静态常量
const uint8_t imageMatrix[][500] = {
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x82,0x0,0x0,0x0,0x31,0xb6,0x4f,0x0,0x3,0xc7,0x0,0x0,0x0,0x31,0xb6,0x49,0x0,0x3,0x6d,0x80,0x0,0x0,0x33,0xae,0x58,0x0,0x6,0x6c,0x0,0x0,0x0,0x33,0xae,0x58,0x0,0x6,0x6c,0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,0x8,0x60,0x0,0x6,0x0,0xe,0xe7,0x0,0x7,0xe0,0x8,0x60,0x0,0xe,0x0,0xe,0xe7,0x0,0x7,0x0,0x0,0x0,0x0,0xe,0x0,0xe,0xf7,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x0,0x1,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x0,0x3,0xfc,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x0,0x7,0xfe,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x0,0xf,0x9f,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xf8,0x1f,0xf,0x80,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x7f,0x7,0xc0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x7c,0x3,0xc0,0x0,0x0,0x0,0x0,0x7,0xff,0xf8,0x38,0x1,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x30,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
};
// 创建对象
DFRobot_NeoPixel neoPixel_P0;
// 主程序开始
void setup() {
mPython.begin();
DF_ChuShiHua();
DF_ZhuYe();
}
void loop() {
}
// 自定义函数
void DF_ChuShiHua() {
buzz.play(ODE, OnceInBackground);
display.setCursorLine(1);
display.printLine("正在初始化.");
neoPixel_P0.begin(P0, 7);
delay(500);
display.fillInLine(1, 0);
display.setCursorLine(1);
display.printLine("正在初始化..");
neoPixel_P0.setBrightness(255);
delay(500);
display.fillInLine(1, 0);
display.setCursorLine(1);
display.printLine("正在初始化...");
neoPixel_P0.clear();
delay(500);
display.fillInLine(1, 0);
display.setCursorLine(1);
display.printLine("正在初始化.");
delay(500);
display.fillInLine(1, 0);
display.setCursorLine(1);
display.printLine("正在初始化..");
delay(500);
display.fillInLine(1, 0);
display.setCursorLine(1);
display.printLine("正在初始化...");
display.fillInLine(1, 0);
delay(1000);
display.drawImage(29, 7, 70, 50, imageMatrix[0]);
delay(12000);
display.fillScreen(0);
delay(1000);
}
void DF_RGB() {
display.fillScreen(0);
display.drawImage(29, 7, 70, 50, imageMatrix[1]);
delay(1000);
while (!(buttonAB.isPressed())) {
if ((touchPadP.isTouched())) {
neoPixel_P0.setRangeColor(0, 0, 0xFFFFFF);
}
else if ((touchPadY.isTouched())) {
neoPixel_P0.setRangeColor(1, 1, 0xFFFFFF);
}
else if ((touchPadT.isTouched())) {
neoPixel_P0.setRangeColor(2, 2, 0xFFFFFF);
}
else if ((touchPadH.isTouched())) {
neoPixel_P0.setRangeColor(3, 3, 0xFFFFFF);
}
else if ((touchPadO.isTouched())) {
neoPixel_P0.setRangeColor(4, 4, 0xFFFFFF);
}
else if ((touchPadN.isTouched())) {
neoPixel_P0.setRangeColor(5, 5, 0xFFFFFF);
}
else if ((buttonA.isPressed())) {
neoPixel_P0.setRangeColor(6, 6, 0xFFFFFF);
}
else {
neoPixel_P0.clear();
}
yield();
}
display.fillScreen(0);
DF_ZhuYe();
}
void DF_ZhuYe() {
neoPixel_P0.clear();
display.fillScreen(0);
display.drawImage(24, 7, 80, 50, imageMatrix[2]);
while (1) {
if ((touchPadP.isTouched())) {
DF_RGB();
}
else {
}
yield();
}
}