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 電子工作室