whether the device is single color, R/G, or R/G/B (do they even exist).
Not that I know of. Mouser has a weird bicolor 10 segment display that has more pins than this does. Betlux is the manufacturer of this display and they have a orange/green model available (why, I don’t know…why not blue/red or something).
Here’s that weird one: [page, [datasheet; there is [this one and [this other one with [datasheet for both. The first one is customizable but has 30 pins and I’ll wager a non-breadboard/prototyping board friendly pinout; the last two are pre-defined colors.
I think this is looking somewhat closer.
Maybe. After the last element of the array has been done for the last block (block 3), there is some “junk” that gets shifted out. Each block is written twice instead of once, which is probably something to do with the ShiftOut function.
More help needed. :mrgreen:
// This project is to map an analog pot to a corresponding value of LEDs via a
// shift register. This is Stage 1 of the 12-LED Bargraph Display Project.
// Based on Project 17 of the Beginning Arduino book and barGraph by Tom Igoe
// VERSION 0.1 BETA TESTING PHASE: Initial goofing off
int latchPin = 4; // Latch / RCK / Pin 12 (74HC595 equivalent) / ST_CP / (RCK Pin 12 TPIC6B595N)
int clockPin = 12; // Clock / SCK / Pin 11 (74HC595 equivalent) / SH_CP / SRCK Pin 13 (TPIC6B595N)
int dataPin = 11; // Data / SER / Pin 14 (74HC595 equivalent) / DS / SER IN Pin 3 (TPIC6B595N)
/* The display is broken up into three blocks of four digits each, with two colors per digit.
Assuming the angled corner indicator is oriented to the lower left, Block 1 is digits A through D,
Block 2 is digits E through H, and Block 3 is digits I through L. The anodes are switched on manually,
then the array is parsed for the appropiate value to send to the shift register. The following defines
what pins the anodes are activated on.*/
int block1Anode = 10;
int block2Anode = 6;
int block3Anode = 9;
/* These are the arrays for each of the blocks. They are binary values, the first four digits from left
to right correspond to a green value, the last four are mapped to the red values.*/
byte block1[] = {B00001111, B11110000, B11111111, B00000000};
byte block2[] = {B00001111, B11110000, B11111111, B00000000};
byte block3[] = {B00001111, B11110000, B11111111, B00000000};
void setup() {
pinMode(latchPin, OUTPUT); // set all pins to output mode
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
block1Func();
block2Func();
block3Func();
}
void block1Func() {
digitalWrite(10, HIGH);
for (int i = 0; i < 8; i++) {
digitalWrite(latchPin, LOW);
shiftOut(block1[i]);
digitalWrite(latchPin, HIGH);
delay(1000);
}
digitalWrite(10, LOW);
}
void block2Func() {
digitalWrite(6, HIGH);
for (int i = 0; i < 8; i++) {
digitalWrite(latchPin, LOW);
shiftOut(block2[i]);
digitalWrite(latchPin, HIGH);
delay(1000);
}
digitalWrite(6, LOW);
}
void block3Func() {
digitalWrite(9, HIGH);
for (int i = 0; i < 8; i++) {
digitalWrite(latchPin, LOW);
shiftOut(block3[i]);
digitalWrite(latchPin, HIGH);
delay(1000);
}
digitalWrite(9, LOW);
}
void shiftOut(byte dataOut) {
// Shift out 8 bits on the LSB first, on rising edge of clock
boolean pinState;
digitalWrite(dataPin, LOW); // clear out shift register to make ready for data input
digitalWrite(clockPin, LOW);
for (int i=0; i<=7; i++) { // for each bit in dataOut send out a bit
digitalWrite(clockPin, LOW); // set clockPin to LOW before sending bit
if ( dataOut & (1<<i) ) { pinState = HIGH; } // if the value of DataOut and (logical AND) a bitmask are true, set pinState to 1 (HIGH)
else { pinState = LOW; }
// sets dataPin to HIGH or LOW depending on pinState
digitalWrite(dataPin, pinState); // send bit out on rising edge of clock
digitalWrite(clockPin, HIGH); }
digitalWrite(clockPin, LOW); // stop shifting data out
}
](HDSP-4830, HDSP-4840, HDSP-4850, HDSP-4832, HDSP-4836, HLCP-J100 10-Element Bar Graph Array Data Sheet)](http://www.mouser.com/ProductDetail/Avago-Technologies/HDSP-4832/?qs=sGAEpiMZZMvkC18yXH9iIsSFKp4VzurG0vAKNM%252bu9zY%3D)](http://www.mouser.com/ProductDetail/Avago-Technologies/HDSP-4836/?qs=sGAEpiMZZMvkC18yXH9iIsSFKp4VzurGtAmc4KGL6bw%3D)](http://www.mouser.com/ds/2/216/DC10EGWA-189864.pdf)](http://www.mouser.com/ProductDetail/Kingbright/DC10EGWA/?qs=sGAEpiMZZMvkC18yXH9iIoSkehDuVhEVlPrqt1C5PXQ%3D)