Skip to content

Instantly share code, notes, and snippets.

@zarya
Created Jun 29, 2013
Embed
What would you like to do?
void setup() {
pinMode(2, OUTPUT); // D1
pinMode(3, OUTPUT); // D0
pinMode(4, OUTPUT); // D2
pinMode(5, OUTPUT); // D6
pinMode(6, OUTPUT); // D4
pinMode(7, OUTPUT); // D3
pinMode(8, OUTPUT); // D5
pinMode(9, OUTPUT); // MR
pinMode(14, OUTPUT); // A0
pinMode(15, OUTPUT); // A1
pinMode(16, OUTPUT); // A2
pinMode(17, OUTPUT); // E1
pinMode(18, OUTPUT); // E2
Serial.begin(9600);
//Unset clear (MR)
digitalWrite(9, HIGH);
//Pull chipselect E to LOW
digitalWrite(17, HIGH);
digitalWrite(18, LOW);
for (int bitje = 0; bitje < 7; bitje++){
digitalWrite(bitje+2, LOW);
}
clean();
}
void setPixels(int RowData, int ColData){
//ColData = ~ColData;
// was 6
for (int ledBlock = 0; ledBlock < 6; ledBlock++){
for (int bitje = 0; bitje < 7; bitje++){
digitalWrite(bitje+2, bitRead(RowData,bitje));
}
//chip select
digitalWrite(14, bitRead(ledBlock,0));
digitalWrite(15, bitRead(ledBlock,1));
digitalWrite(16, bitRead(ledBlock,2));
digitalWrite(17, LOW);
digitalWrite(17, HIGH);
//Colom thing
//A0 D3 7
//A1 D4 6
//A2 D6 5
/*
digitalWrite(8,HIGH);
digitalWrite(5,bitRead(ColData,2));
digitalWrite(6,bitRead(ColData,1));
digitalWrite(7,bitRead(ColData,0));
// digitalWrite(5,LOW);
// digitalWrite(6,HIGH);
// digitalWrite(7,LOW);
digitalWrite(14, bitRead(6,0));
digitalWrite(15, bitRead(6,1));
digitalWrite(16, bitRead(6,2));
digitalWrite(17, LOW);
digitalWrite(17, HIGH);
/*
digitalWrite(5,bitRead(ColData,0));
digitalWrite(6,bitRead(ColData,2));
digitalWrite(7,bitRead(ColData,1));
digitalWrite(14, bitRead(7,0));
digitalWrite(15, bitRead(7,1));
digitalWrite(16, bitRead(7,2));
digitalWrite(17, LOW);
digitalWrite(17, HIGH);
*/
}
}
void clean() {
/*for (int thisPin = 0; thisPin < 1; thisPin++) {
for (int bitje = 2; bitje < 9; bitje++){
digitalWrite(bitje, bitRead(thisPin,bitje-2));
}
//chip select
int block = 0;
digitalWrite(14, bitRead(block,0));
digitalWrite(15, bitRead(block,1));
digitalWrite(16, bitRead(block,2));
//digitalWrite(17, HIGH);
//digitalWrite(17, LOW);
}*/
digitalWrite(9,LOW);
digitalWrite(9,HIGH);
}
void loop() {
setPixels(127,0);
/*for(int pixel = 0; pixel < 128; pixel++){
setPixels(pixel,0);
//delay(5);
}*/
//clean();
//delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment