projects
/
Arduino
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b759042
)
fix line endings
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 17 Dec 2015 18:09:56 +0000
(19:09 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 17 Dec 2015 18:09:56 +0000
(19:09 +0100)
HUB12_simple/HUB12_simple.ino
patch
|
blob
|
history
diff --git
a/HUB12_simple/HUB12_simple.ino
b/HUB12_simple/HUB12_simple.ino
index
fa2def0
..
ad26c2d
100644
(file)
--- a/
HUB12_simple/HUB12_simple.ino
+++ b/
HUB12_simple/HUB12_simple.ino
@@
-6,9
+6,9
@@
* http://blog.vettore.org/building-a-large-led-sign-with-inexpensive-standard-modules-and-arduino/
*
*************************************************************/
* http://blog.vettore.org/building-a-large-led-sign-with-inexpensive-standard-modules-and-arduino/
*
*************************************************************/
-
+
#include <SPI.h>
#include <SPI.h>
-
+
//Pins specific for Mega .See Arduino SPI for a different board.
#define A 22
#define B 24
//Pins specific for Mega .See Arduino SPI for a different board.
#define A 22
#define B 24
@@
-16,17
+16,17
@@
#define R1 51
#define CLK 52
#define STB 53
#define R1 51
#define CLK 52
#define STB 53
-
-
+
+
//row to be shown (1-4 since it is 1/4 scan)
byte row=0;
//row to be shown (1-4 since it is 1/4 scan)
byte row=0;
-
+
//brightness: increase->more bright
int br=500;
//brightness: increase->more bright
int br=500;
-
+
//some digits from a 8x8 font (numeric 1-8)
byte digits[]={
//some digits from a 8x8 font (numeric 1-8)
byte digits[]={
-
+
0x04, //1
0x0C,
0x04,
0x04, //1
0x0C,
0x04,
@@
-35,7
+35,7
@@
byte digits[]={
0x04,
0x0E,
0x00,
0x04,
0x0E,
0x00,
-
+
0x0E, //2
0x11,
0x01,
0x0E, //2
0x11,
0x01,
@@
-44,8
+44,7
@@
byte digits[]={
0x08,
0x1F,
0x00,
0x08,
0x1F,
0x00,
-
-
+
0x1F, //3
0x02,
0x04,
0x1F, //3
0x02,
0x04,
@@
-54,7
+53,7
@@
byte digits[]={
0x11,
0x0E,
0x00,
0x11,
0x0E,
0x00,
-
+
0x02, //4
0x06,
0x0A,
0x02, //4
0x06,
0x0A,
@@
-63,7
+62,7
@@
byte digits[]={
0x02,
0x02,
0x00,
0x02,
0x02,
0x00,
-
+
0x1F, //5
0x10,
0x1E,
0x1F, //5
0x10,
0x1E,
@@
-72,8
+71,7
@@
byte digits[]={
0x11,
0x0E,
0x00,
0x11,
0x0E,
0x00,
-
-
+
0x06, //6
0x08,
0x10,
0x06, //6
0x08,
0x10,
@@
-82,7
+80,7
@@
byte digits[]={
0x11,
0x0E,
0x00,
0x11,
0x0E,
0x00,
-
+
0x1F,//7
0x01,
0x02,
0x1F,//7
0x01,
0x02,
@@
-91,8
+89,7
@@
byte digits[]={
0x04,
0x04,
0x00,
0x04,
0x04,
0x00,
-
-
+
0x0E,//8
0x11,
0x11,
0x0E,//8
0x11,
0x11,
@@
-101,15
+98,9
@@
byte digits[]={
0x11,
0x0E,
0x00,
0x11,
0x0E,
0x00,
-
-
-
-
-
+
};
};
-
-
-
+
void setup () {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
void setup () {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
@@
-120,8
+111,8
@@
void setup () {
SPI.begin();
delay(300);
}
SPI.begin();
delay(300);
}
-
-
+
+
//display alternatively scan lines
void loop(){
showRow(0);
//display alternatively scan lines
void loop(){
showRow(0);
@@
-129,49
+120,48
@@
void loop(){
showRow(2);
showRow(3);
}
showRow(2);
showRow(3);
}
-
-
+
+
//Load and show row (1-4) i.e. 1 and 5, 2 and 6.....
void showRow(int row){
//Load and show row (1-4) i.e. 1 and 5, 2 and 6.....
void showRow(int row){
-
+
SPI.transfer(~(digits[row+36])); //5
SPI.transfer(~(digits[row+32]));
SPI.transfer(~(digits[row+36])); //5
SPI.transfer(~(digits[row+32]));
-
+
SPI.transfer(~(digits[row+4])); //1
SPI.transfer(~(digits[row]));
SPI.transfer(~(digits[row+4])); //1
SPI.transfer(~(digits[row]));
-
+
SPI.transfer(~(digits[row+44])); //6
SPI.transfer(~(digits[row+40]));
SPI.transfer(~(digits[row+44])); //6
SPI.transfer(~(digits[row+40]));
-
+
SPI.transfer(~(digits[row+12])); //2
SPI.transfer(~(digits[row+8]));
SPI.transfer(~(digits[row+12])); //2
SPI.transfer(~(digits[row+8]));
-
+
SPI.transfer(~(digits[row+52])); //7
SPI.transfer(~(digits[row+48]));
SPI.transfer(~(digits[row+52])); //7
SPI.transfer(~(digits[row+48]));
-
+
SPI.transfer(~(digits[row+20])); //3
SPI.transfer(~(digits[row+16]));
SPI.transfer(~(digits[row+20])); //3
SPI.transfer(~(digits[row+16]));
-
+
SPI.transfer(~(digits[row+60])); //8
SPI.transfer(~(digits[row+56]));
SPI.transfer(~(digits[row+60])); //8
SPI.transfer(~(digits[row+56]));
-
+
SPI.transfer(~(digits[row+28])); //4
SPI.transfer(~(digits[row+24]));
SPI.transfer(~(digits[row+28])); //4
SPI.transfer(~(digits[row+24]));
-
+
digitalWrite(STB,LOW);
digitalWrite(STB,HIGH);
digitalWrite(STB,LOW);
digitalWrite(STB,HIGH);
-
+
scanrow(row);//enable encoder for the line loaded
scanrow(row);//enable encoder for the line loaded
-
+
//PWM like. Change br to adjust brightnes
digitalWrite(OE,HIGH);
delayMicroseconds(br);
digitalWrite(OE,LOW);
delayMicroseconds(900);
//PWM like. Change br to adjust brightnes
digitalWrite(OE,HIGH);
delayMicroseconds(br);
digitalWrite(OE,LOW);
delayMicroseconds(900);
-
-
+
}
}
-
+
//enable encoder for this row in order to show it
void scanrow(int r){
if(r==0){
//enable encoder for this row in order to show it
void scanrow(int r){
if(r==0){
@@
-191,5
+181,3
@@
void scanrow(int r){
digitalWrite(B,1);
}
}
digitalWrite(B,1);
}
}
-
-