Bargraph Segment LED Module (SHB10R) [D024]



https://www.youtube.com/watch?v=-Qtzp6CA7Cc


*GitHubhttps://github.com/rdiot/rdiot-d024.git


* Specs

These 10 segment bar graph LEDs have many uses. With a compact footprint, and a simple hookup, they are easy for prototyping or finished products. Essentially, they are 10 individual red LEDs housed together.


Forward Current (Per Segment): 25mA

Max Reverse Voltage: 5v

10 segment bar

Color: Super Bright Red

Industrial standard size

Low power consumption

Categorized for luminous intensity 


* Contents

- Connect

1  ----- D2  - R220 - GND

2  ----- D3  - R220 - GND

3  ----- D4  - R220 - GND

4  ----- D5  - R220 - GND

5  ----- D6  - R220 - GND

6  ----- D7  - R220 - GND

7  ----- D8  - R220 - GND

8  ----- D9  - R220 - GND

9  ----- D10  - R220 - GND

10  ----- D11  - R220 - GND


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

 

LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

 

int segPins[] = { 2,3,4,5,6,7,8,9,10,11 };

int idxBar = 0;

int minVal = 50;

int maxVal = 350;

int delayTime = 200;

 

byte digitsFill[10][10] = {

  {1,0,0,0,0,0,0,0,0,0},

  {1,1,0,0,0,0,0,0,0,0},

  {1,1,1,0,0,0,0,0,0,0},

  {1,1,1,1,0,0,0,0,0,0},

  {1,1,1,1,1,0,0,0,0,0},

  {1,1,1,1,1,1,0,0,0,0},

  {1,1,1,1,1,1,1,0,0,0},

  {1,1,1,1,1,1,1,1,0,0},

  {1,1,1,1,1,1,1,1,1,0},

  {1,1,1,1,1,1,1,1,1,1}

};

 

void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

 

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

  {

    pinMode(segPins[i], OUTPUT);

  }

 

  delay(1000);

 

  lcd.clear();

}

 

void loop()

{

  lcd.setCursor(0,0);

  lcd.print("D024:Bargraph LED");

 

  idxBar = map(analogRead(A0), minVal, maxVal, 0, 9);

 

  lcd.setCursor(0,1);

  lcd.print("analog=" + (String)analogRead(A0) + "  ");

 

  for(int j=0; j<10; j++)

  {

    digitalWrite(segPins[j], digitsFill[idxBar][j]);

 

    lcd.setCursor(0,2);

    lcd.print("idxBar="+(String)idxBar+" "); 

  }

   delay(delayTime);

}

'3) Actuator > LED' 카테고리의 다른 글

12V 4W 48 COB LED Lamp Light [D078]  (0) 2016.09.19
Arrow Indicator 14 SMD LED Blue [D077]  (0) 2016.09.19
Magic Cup Light Module (KY-027) [D020]  (0) 2016.09.18
RGB LED Module SMD (KY-009) [D008]  (0) 2016.09.18
RGB LED Module DIP (KY-016) [D007]  (0) 2016.09.18
Posted by RDIoT
|