Arduino 8*8点阵实验(文尾有彩蛋)

本篇文章主要讲解如何使用Arduino控制8x8点阵,这里使用的是带有8x8点阵的拓展板,某宝有售

示例代码

#include "LedControl.h"

LedControl lc = LedControl(12, 11, 13, 1);
int i = 0;
void setup()
{
  lc.shutdown(0, false);
  lc.setIntensity(0, 8);
  lc.clearDisplay(0);

}

void doshow() {

  lc.setRow(0, 0, B01100110);
  lc.setRow(0, 1, B11111111);
  lc.setRow(0, 2, B11111111);
  lc.setRow(0, 3, B11111111);
  lc.setRow(0, 4, B01111110);
  lc.setRow(0, 5, B00111100);
  lc.setRow(0, 6, B00011000);
  lc.setRow(0, 7, B00000000);
}

void donoshow() {
  lc.setRow(0, 0, B00000000);
  lc.setRow(0, 1, B00000000);
  lc.setRow(0, 2, B00000000);
  lc.setRow(0, 3, B00000000);
  lc.setRow(0, 4, B00000000);
  lc.setRow(0, 5, B00000000); 
  lc.setRow(0, 6, B00000000);
  lc.setRow(0, 7, B00000000);
}

void loop()
{
  delay(1000);
  doshow();
  delay(1000);
  donoshow();
}

效果演示

qq_pic_merged_1566906504046.jpg

你可能感兴趣的:(Arduino 8*8点阵实验(文尾有彩蛋))