“4位数码管模块”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
第15行: 第15行:
 
=== 规格参数 ===
 
=== 规格参数 ===
 
<br>
 
<br>
1) 数码管:0.36 英寸,4 位
+
* 数码管:0.56 英寸,4 位
 
+
* 驱动IC:TM1650
2) 驱动IC:TM1650
+
* 工作电压 3V~5V
 
+
* 工作温度:-40℃~80℃
3) 工作电压 3V~5V
+
* 亮度等级:8 级亮度可设置
 
+
* 模块尺寸:50.5mm * 19.5mm  
4)输入电压 3V~5.5V
+
 
+
5) 工作温度:-40℃~80℃
+
 
+
6) 亮度等级:8 级亮度可设置
+
 
+
7) 模块尺寸:50.5mm * 19.5mm  
+
8)安装孔中心距:42mm * 12mm
+
+
9)生产工艺:环保无铅
+
*模块尺寸:28*21*24MM(长*宽*高)
+
 
*安装孔:3mm
 
*安装孔:3mm
*安装孔 :15mm
+
*安装孔 中心 :42mm * 12mm
 
*模块重量:3.8g
 
*模块重量:3.8g
  

2019年12月2日 (一) 17:28的版本

生成缩略图出错:文件可能丢失:
4位数码管


产品简介


4位数码管模块 0.56英寸 小数点 时钟()


规格参数


  • 数码管:0.56 英寸,4 位
  • 驱动IC:TM1650
  • 工作电压 3V~5V
  • 工作温度:-40℃~80℃
  • 亮度等级:8 级亮度可设置
  • 模块尺寸:50.5mm * 19.5mm
  • 安装孔:3mm
  • 安装孔中心距:42mm * 12mm
  • 模块重量:3.8g


引脚说明


  • 1. G 黑线 -- Gnd(地)
  • 2. V 红线 -- Vcc(电源+5V)
  • 3. S 白线 -- 信号


应用示例


电路连接示意图

电位器模块的 G、V、S分别连接 Arduino UNO的GND、VCC(+5V)、A0引脚。

potentiometer1


示例代码

示例一:电位器值串口打印

/*
 Potentiometer Test
*/
int pPin = A0;
int pVal = 0;
int pVal_old = 0;
void setup()
{
  pinMode(pPin,INPUT);      
  Serial.begin(9600);  
}
void loop()
{
  //读取A0模拟口的数值(0-5V 对应 0-1204取值)
  pVal = analogRead(pPin);   
  if(abs(pVal - pVal_old) >= 2 ){
    Serial.println(pVal); 
    pVal_old = pVal;
  }
}

程序下载地址:PotentiometerTest

程序运行结果:电位器值串口打印,结果如下图:

生成缩略图出错:文件可能丢失:




示例二:电位器控制彩色LED模块变色
电路连接示意图

potentiometer2


/*
  Potentiometer control RGB LED change color
*/

#include <Adafruit_NeoPixel.h>

#define RGBLEDPin  5
#define NUMPIXELS  4
#define pPin  A0

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, RGBLEDPin, NEO_GRB + NEO_KHZ800);

int pVal = 0;
int RVal = 0;
int GVal = 0;
int BVal = 0;

void setup()
{
  pinMode(RGBLEDPin, OUTPUT);
  pixels.begin(); // This initializes the NeoPixel library.
  pixels.show();
}

void loop()
{
  pVal = analogRead(pPin);    //读取A0模拟口的数值(0-5V 对应 0-1203取值)
  if (pVal >= 0 && pVal <= 170) {
    RVal = 255;
    GVal = 0;
    BVal = map(pVal, 0, 170, 0, 255);
  } else if (pVal > 170 && pVal <= 340) {
    RVal = map(pVal, 170, 340, 255, 0);
    GVal = 0;
    BVal = 255;
  } else if (pVal > 340 && pVal <= 510) {
    RVal = 0;
    GVal = map(pVal, 340, 510, 0, 255);
    BVal = 255;
  } else if (pVal > 510 && pVal <= 680) {
    RVal = 0;
    GVal = 255;
    BVal = map(pVal, 510, 680, 255, 0);
  } else if (pVal > 680 && pVal <= 850) {
    RVal = map(pVal, 680, 850, 0, 255);
    GVal = 255;
    BVal = 0;
  } else {
    RVal = 255;
    GVal = map(pVal, 850, 1023, 255, 0);
    BVal = 0;
  }
  lightLED(RVal, GVal, BVal);
}

void lightLED(int r, int g , int b) {
  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  for (int i = 0; i < NUMPIXELS; i++) {
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, r, g, b); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
  }
}

程序下载地址:ChangeColor

程序运行结果:转动电位器,彩色led变色。






返回首页

更多建议和问题欢迎反馈至 YFRobot论坛

购买方式:YFRobot 电子工作室