感谢小撸送的字符模块,型号好像是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);
}
打赏帖 | |
---|---|
嵌入式LinuxC语言程序调试和宏使用技巧被打赏50分 | |
让代码中包含最新的编译时间信息被打赏50分 | |
rtthread硬件加密--2crc加密分析被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】mcxa156使用低功耗定时器适配硬件RTC框架被打赏26分 | |
【STM32F769】AI之与本地deepseek对接被打赏50分 | |
Buck电路工作在CCM模式下电感电流的计算公式是什么?被打赏5分 | |
buck电路工作原理被打赏5分 | |
基于MSPM0L1306的MODBUS-RTU协议通讯实验被打赏100分 | |
我想要一部加热台+多合一调试工具被打赏18分 | |
每周了解几个硬件知识+485硬件知识分享被打赏10分 |