感谢小撸送的字符模块,型号好像是HPDL-1414,研究了一下午,终于用Arduino点亮了,记录一下历程吧。
首先用到的是小撸送的字符模块,很漂亮
void setup() { pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); digitalWrite(11, HIGH); digitalWrite(12, HIGH); //* digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, LOW); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, HIGH); digitalWrite(8, LOW); //1 digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, LOW); digitalWrite(11, HIGH); //A digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(6, LOW); digitalWrite(7, LOW); digitalWrite(8, HIGH); //2 digitalWrite(9, LOW); digitalWrite(10, HIGH); digitalWrite(11, LOW); digitalWrite(11, HIGH); //N digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, HIGH); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, LOW); digitalWrite(8, HIGH); //3 digitalWrite(9, HIGH); digitalWrite(10, LOW); digitalWrite(11, LOW); digitalWrite(11, HIGH); //Q digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(6, HIGH); digitalWrite(7, LOW); digitalWrite(8, HIGH); //4 digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); digitalWrite(11, HIGH); //I digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, LOW); digitalWrite(8, HIGH); //5 digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(12, LOW); digitalWrite(12, HIGH); //L digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, HIGH); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, LOW); digitalWrite(8, HIGH); //6 digitalWrite(9, LOW); digitalWrite(10, HIGH); digitalWrite(12, LOW); digitalWrite(12, HIGH); //A digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(6, LOW); digitalWrite(7, LOW); digitalWrite(8, HIGH); //7 digitalWrite(9, HIGH); digitalWrite(10, LOW); digitalWrite(12, LOW); digitalWrite(12, HIGH); //* digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, LOW); digitalWrite(5, HIGH); digitalWrite(6, LOW); digitalWrite(7, HIGH); digitalWrite(8, LOW); //8 digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(12, LOW); digitalWrite(12, HIGH); } void loop() { delay(1000); }
在球猫的提示下的球猫版代码HelloCat!
void writeChar(int p,char ch)
{
digitalWrite(2, (ch>>0) & 1);
digitalWrite(3, (ch>>1) & 1);
digitalWrite(4, (ch>>2) & 1);
digitalWrite(5, (ch>>3) & 1);
digitalWrite(6, (ch>>4) & 1);
digitalWrite(7, (ch>>5) & 1);
digitalWrite(8, (ch>>6) & 1);
digitalWrite(9, !((p>>0)&1));
digitalWrite(10, !((p>>1)&1));
if (p>>2)
{
digitalWrite(A2, LOW);
digitalWrite(A2, HIGH);
}else{
digitalWrite(A1, LOW);
digitalWrite(A1, HIGH);
}}
void writeString(char *str)
{
int i;
for(i=0;i<8;i++)
{
if(str[i]==0)
break;
writeChar(i,str[i]);
}
}
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
digitalWrite(A1, HIGH);
digitalWrite(A2, HIGH);
writeString("HELLOCAT");
}
void loop() {
delay(1000);
}
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
vscode+cmake搭建雅特力AT32L021开发环境被打赏30分 | |
【换取逻辑分析仪】自制底板并驱动ArduinoNanoRP2040ConnectLCD扩展板被打赏47分 | |
【分享评测,赢取加热台】RISC-V GCC 内嵌汇编使用被打赏38分 | |
【换取逻辑分析仪】-基于ADI单片机MAX78000的简易MP3音乐播放器被打赏48分 | |
我想要一部加热台+树莓派PICO驱动AHT10被打赏38分 | |
【换取逻辑分析仪】-硬件SPI驱动OLED屏幕被打赏36分 | |
换逻辑分析仪+上下拉与多路选择器被打赏29分 | |
Let'sdo第3期任务合集被打赏50分 | |
换逻辑分析仪+Verilog三态门被打赏27分 | |
换逻辑分析仪+Verilog多输出门被打赏24分 |