Shiftout LED套件 兼容Arduino(SKU:DFR0089)

来自DFRobot Product Wiki
跳转至: 导航搜索
DFR0089.jpg

目录

概述

Shiftout LED Kit是一款小型的LED显示套件,可级联成多个LED显示。你可以使用这个套件完成一个简单的定时、计数器或者时钟模块,在其他互动媒体系统中它也可以作为一个显示模块。可以配合SPI LED模块一起使用。


技术规格

  • 模块工作电压:5V
  • 通讯接口:SPI
  • LED数码管:共阳极
  • 可级联数量:16个以上
  • 可直插接入Interface Shield使用
  • 组合尺寸:41X30X25mm

引脚说明

shiftout数字引脚寄存器:3,8,9


示例代码

//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 3;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 9;
byte Tab[]={
  0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("reset");
  for(int i = 0;i < 10; i++){
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, Tab[i]);
    digitalWrite(latchPin, HIGH);
    delay(500);
  }
}
void loop() {
  if (Serial.available() > 0) {
    // ASCII '0' through '9' characters are
    // represented by the values 48 through 57.
    // so if the user types a number from 0 through 9 in ASCII, 
    // you can subtract 48 to get the actual value:
    int bitToSet = Serial.read() - 48;
    // write to the shift register with the correct bit set high:
    digitalWrite(latchPin, LOW);
    // shift the bits out:
    shiftOut(dataPin, clockPin, MSBFIRST, Tab[bitToSet]);
    // turn on the output so the LEDs can light up:
    digitalWrite(latchPin, HIGH);
  }
}




Nextredirectltr.png购买 Shiftout LED套件 兼容Arduino(SKU:DFR0089)

个人工具
名字空间

变换
操作
导航
工具箱