用Arduino点亮HPDL-1414

感谢小撸送的字符模块,型号好像是HPDL-1414,研究了一下午,终于用Arduino点亮了,记录一下历程吧。
01.jpg

首先用到的是小撸送的字符模块,很漂亮
07.jpg

这个字符模块是很多种显示模块中的一种,据说型号是HPDL-1414,二叔科技群里找到了大球上传的datasheet,这球也是出了名的懒,就叫datasheet.pdf,费了半天力气才找到。
05.jpg

大球是较早点亮的,而且是用香蕉,但是为啥显示的是MO10呢,暗恋?
04.jpg

先在网上查找资料,在数码之家看有人用四个做电脑资源显示器。
08.jpg

回顾了模块的pdf文档,感觉似乎只能显示字符,不能随意单点,大球说可以,估计他理解错了。
10.png

这个被羞弟称为电饭锅常用的流水灯效果估计是做不出来的。
09.png

好啦,言归正传,开始试验,一次点两个,少不了一些pdf中的资料
11.png
06.png

然后在面包板上将两个模块并联,为啥不亮呢?
03.jpg

在小撸的提示下仔细排查,最终发现忘了接电了,能亮才怪,接上电还是很漂亮的。
02.jpg

下面就是用程序控制显示的内容了,先是些什么呢,这个可是能显示字母的,研究了一下午,终于搞定。

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);
}

运行效果如开始的图
01.jpg

在球猫的提示下的球猫版代码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);
}

标签: none

添加新评论