最新消息:680元/半年,推荐全网最具性价比的一站式编程学习平台码丁实验室

arduino从零开始(23)max7219LED矩阵

Arduino 少儿编程 2016浏览 0评论

友情提示:680元/半年,儿童学编程,就上码丁实验室

arduino从零开始(23)max7219LED矩阵


你将学到什么

你将学到使用arduino控制一个8X8的LED矩阵

视频内容


视频若不清晰,1080P视频地址:

https://v.qq.com/x/page/g05583pt7gq.html?

文字代码如下

//We always have to include the library

#include “LedControl.h”

/*

 Now we need a LedControl to work with.

 ***** These pin numbers will probably not work with your hardware *****

 pin 12 is connected to the DataIn 

 pin 11 is connected to the CLK 

 pin 10 is connected to LOAD/CS 

 We have only a single MAX72XX.

 */

LedControl lc=LedControl(12,11,10,1);

void setup() {

  // put your setup code here, to run once:

  /*

   The MAX72XX is in power-saving mode on startup,

   we have to do a wakeup call

   */

  lc.shutdown(0,false);

  /* Set the brightness to a medium values */

  lc.setIntensity(0,8);

  /* and clear the display */

  lc.clearDisplay(0);

}

void loop() {

  // put your main code here, to run repeatedly:

  byte eight[8]= {0x7E,0x7E,0×66,0x7E,0x7E,0×66,0x7E,0x7E};  //8

  byte smeil[8]={

                  B00111100,

                  B01000010,

                  B10100101,

                  B10000001,

                  B10100101,

                  B10011001,

                  B01000010,

                  B00111100

    };

  for(int i=0;i<8;i++)

  {

    lc.setRow(0,i,eight[i]);

    }

    delay(1000);

    lc.clearDisplay(0);

    for(int i=0;i<8;i++)

  {

    lc.setColumn(0,i,eight[i]);

    }

    delay(1000);

     lc.clearDisplay(0);

  for(int i=0;i<8;i++)

  {

    lc.setRow(0,i,smeil[i]);

    }

    delay(1000);

     lc.clearDisplay(0);

    for(int row=0;row<8;row++)//行

    {

      for(int col=0;col<8;col++)

      {

        lc.setLed(0,row,col,true);

        delay(100);

        }

      }

}




您必须 登录 才能发表评论!