【问题标题】:Arduino control 9 * 16 LED MatrixArduino控制9*16 LED矩阵
【发布时间】:2012-08-22 21:15:01
【问题描述】:

我正处于一个使用 Arduino Uno R3 的小项目之间,我必须控制一个 9 X 16 LED 矩阵。

在我开始该项目之前,我计划使用 8 X 8 LED 矩阵(解决方案 here 适用于 8X8),我知道如果我使用 Arduino Mega(具有更多输出引脚),同样的解决方案也将起作用

谁能建议我如何使用 Arduino UNO 控制 9 * 16 LED 矩阵

【问题讨论】:

    标签: arduino


    【解决方案1】:

    您可以使用一些MAX7221 LED 驱动芯片驱动多达 512 个 LED。 有关说明,请参阅here

    【讨论】:

      【解决方案2】:

      另一种方法是使用多路复用器。它们允许您使用很少的 arduino 引脚来处理许多输出(或输入)。

      类似于左侧的设置将允许嵌套多路复用器以实现对更多 LED 的控制。您会遇到的唯一问题是 LED 在处理期间可能会变暗。

      这是有关该主题的 Arduino 页面(带有示例代码)。 http://www.arduino.cc/playground/Learning/4051

      /*
       * codeexample for useing a 4051 * analog multiplexer / demultiplexer
       * by david c. and tomek n.* for k3 / malm� h�gskola
       *
       * edited by Ross R.
       */  
      
      int r0 = 0;      //value of select pin at the 4051 (s0)
      int r1 = 0;      //value of select pin at the 4051 (s1)
      int r2 = 0;      //value of select pin at the 4051 (s2)
      int count = 0;   //which y pin we are selecting
      
      void setup(){
      
        pinMode(2, OUTPUT);    // s0
        pinMode(3, OUTPUT);    // s1
        pinMode(4, OUTPUT);    // s2
      }
      
      void loop () {
      
        for (count=0; count<=7; count++) {
      
          // select the bit  
          r0 = bitRead(count,0);    // use this with arduino 0013 (and newer versions)     
          r1 = bitRead(count,1);    // use this with arduino 0013 (and newer versions)     
          r2 = bitRead(count,2);    // use this with arduino 0013 (and newer versions)     
      
          //r0 = count & 0x01;      // old version of setting the bits
          //r1 = (count>>1) & 0x01;      // old version of setting the bits
          //r2 = (count>>2) & 0x01;      // old version of setting the bits
      
          digitalWrite(2, r0);
          digitalWrite(3, r1);
          digitalWrite(4, r2);
      
          //Either read or write the multiplexed pin here
      
        }  
      }
      

      看看这样的东西:http://www.arduino.cc/playground/Learning/4051

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-09-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多