Adafruit32x16RGB: Difference between revisions
From Bloominglabs
Jump to navigationJump to search
(New page: I am working on a project using [http://www.adafruit.com/products/420&zenid=19e0e0e853fdff51f9d2f6b94233efbe 16x32 RGB Panel].) |
No edit summary |
||
Line 1: | Line 1: | ||
I am working on a project using [http://www.adafruit.com/products/420&zenid=19e0e0e853fdff51f9d2f6b94233efbe 16x32 RGB Panel]. |
I am working on a project using [http://www.adafruit.com/products/420&zenid=19e0e0e853fdff51f9d2f6b94233efbe 16x32 RGB Panel]. |
||
Here is a video of the panel working: |
|||
[http://www.youtube.com/watch?v=q_ko3kHqsXY] |
|||
I wanted to figure out the timing for the interface so I wrote the code myself without using the sample code. |
|||
Here is the sample code: |
|||
// test the 32x16 LED board. Public Domain. |
|||
#define A A0 |
|||
#define B A1 |
|||
#define C A2 |
|||
#define LAT A3 |
|||
#define OE 9 |
|||
#define CLK 8 |
|||
#define R1 2 |
|||
#define G1 3 |
|||
#define B1 4 |
|||
#define R2 5 |
|||
#define G2 6 |
|||
#define B2 7 |
|||
void setup() { |
|||
Serial.begin(115200); |
|||
pinMode(R1,OUTPUT); |
|||
pinMode(G1,OUTPUT); |
|||
pinMode(B1,OUTPUT); |
|||
pinMode(R2,OUTPUT); |
|||
pinMode(G2,OUTPUT); |
|||
pinMode(B2,OUTPUT); |
|||
pinMode(CLK,OUTPUT); |
|||
pinMode(OE,OUTPUT); |
|||
pinMode(A,OUTPUT); |
|||
pinMode(B,OUTPUT); |
|||
pinMode(C,OUTPUT); |
|||
pinMode(LAT,OUTPUT); |
|||
digitalWrite(A,LOW); |
|||
digitalWrite(B,LOW); |
|||
digitalWrite(C,LOW); |
|||
digitalWrite(LAT,LOW); |
|||
digitalWrite(OE,LOW); |
|||
digitalWrite(CLK,HIGH); |
|||
} |
|||
void updateRow(int i) { |
|||
digitalWrite(OE,LOW); |
|||
// Set the row address |
|||
if ( i & 0x1 ) { |
|||
digitalWrite(A,HIGH); |
|||
} else { |
|||
digitalWrite(A,LOW); |
|||
} |
|||
if ( i & 0x2 ) { |
|||
digitalWrite(B,HIGH); |
|||
} else { |
|||
digitalWrite(B,LOW); |
|||
} |
|||
if ( i & 0x4 ) { |
|||
digitalWrite(C,HIGH); |
|||
} else { |
|||
digitalWrite(C,LOW); |
|||
} |
|||
for ( uint8_t x = 0; x < 64; x++ ) { |
|||
digitalWrite(CLK,LOW); |
|||
if ( x > 31 ) { |
|||
// This will end up on the display closest to the arduino |
|||
digitalWrite(R1,HIGH); |
|||
digitalWrite(G1,HIGH); |
|||
digitalWrite(B1,HIGH); |
|||
digitalWrite(R2,LOW); |
|||
digitalWrite(G2,LOW); |
|||
digitalWrite(B2,HIGH); |
|||
} else { |
|||
// This will end up on the display farthest from the arduino |
|||
digitalWrite(R1,LOW); |
|||
digitalWrite(G1,HIGH); |
|||
digitalWrite(B1,LOW); |
|||
digitalWrite(R2,HIGH); |
|||
digitalWrite(G2,LOW); |
|||
digitalWrite(B2,LOW); |
|||
} |
|||
digitalWrite(CLK,HIGH); |
|||
} |
|||
digitalWrite(LAT,HIGH); |
|||
digitalWrite(LAT,LOW); |
|||
digitalWrite(OE,HIGH); |
|||
} |
|||
void loop() { |
|||
for ( int i = 0; i < 8; i++ ) { |
|||
updateRow(i); |
|||
} |
|||
} |
|||
Here is a video of it working: |
|||
[http://www.youtube.com/watch?v=-iVad2X3Yfo] |
|||
I tried the sample programs with 2 cascaded displays and they were mirrored for some reason. I'm not sure why. Also, the first row is corrupted. Here are videos of that happening: |
|||
[http://www.youtube.com/watch?v=-iVad2X3Yfo] |
|||
[http://www.youtube.com/watch?v=K6YONDkpExg] |
Revision as of 21:59, 22 August 2011
I am working on a project using 16x32 RGB Panel.
Here is a video of the panel working:
I wanted to figure out the timing for the interface so I wrote the code myself without using the sample code.
Here is the sample code:
// test the 32x16 LED board. Public Domain.
- define A A0
- define B A1
- define C A2
- define LAT A3
- define OE 9
- define CLK 8
- define R1 2
- define G1 3
- define B1 4
- define R2 5
- define G2 6
- define B2 7
void setup() {
Serial.begin(115200);
pinMode(R1,OUTPUT); pinMode(G1,OUTPUT); pinMode(B1,OUTPUT); pinMode(R2,OUTPUT); pinMode(G2,OUTPUT); pinMode(B2,OUTPUT); pinMode(CLK,OUTPUT); pinMode(OE,OUTPUT); pinMode(A,OUTPUT); pinMode(B,OUTPUT); pinMode(C,OUTPUT); pinMode(LAT,OUTPUT);
digitalWrite(A,LOW); digitalWrite(B,LOW); digitalWrite(C,LOW); digitalWrite(LAT,LOW); digitalWrite(OE,LOW); digitalWrite(CLK,HIGH);
}
void updateRow(int i) {
digitalWrite(OE,LOW);
// Set the row address if ( i & 0x1 ) { digitalWrite(A,HIGH); } else { digitalWrite(A,LOW); } if ( i & 0x2 ) { digitalWrite(B,HIGH); } else { digitalWrite(B,LOW); } if ( i & 0x4 ) { digitalWrite(C,HIGH); } else { digitalWrite(C,LOW); }
for ( uint8_t x = 0; x < 64; x++ ) { digitalWrite(CLK,LOW);
if ( x > 31 ) { // This will end up on the display closest to the arduino digitalWrite(R1,HIGH); digitalWrite(G1,HIGH); digitalWrite(B1,HIGH); digitalWrite(R2,LOW); digitalWrite(G2,LOW); digitalWrite(B2,HIGH); } else { // This will end up on the display farthest from the arduino digitalWrite(R1,LOW); digitalWrite(G1,HIGH); digitalWrite(B1,LOW); digitalWrite(R2,HIGH); digitalWrite(G2,LOW); digitalWrite(B2,LOW); } digitalWrite(CLK,HIGH); } digitalWrite(LAT,HIGH); digitalWrite(LAT,LOW); digitalWrite(OE,HIGH);
}
void loop() {
for ( int i = 0; i < 8; i++ ) { updateRow(i); }
}
Here is a video of it working:
I tried the sample programs with 2 cascaded displays and they were mirrored for some reason. I'm not sure why. Also, the first row is corrupted. Here are videos of that happening: