Skip to content

Instantly share code, notes, and snippets.

@zarya
Created Jun 27, 2013
Embed
What would you like to do?
// 2 - 8 D0 - D6
// 9 - MR
// A0 - A0
// A1 - A1
// A2 - A2
// A3 - E1
// A3 - E2
int ledBlock = 0;
void setup() {
pinMode(2, OUTPUT); // D0
pinMode(3, OUTPUT); // D1
pinMode(4, OUTPUT); // D2
pinMode(5, OUTPUT); // D3
pinMode(6, OUTPUT); // D4
pinMode(7, OUTPUT); // D5
pinMode(8, OUTPUT); // D6
pinMode(9, OUTPUT); // MR
pinMode(14, OUTPUT); // A0
pinMode(15, OUTPUT); // A1
pinMode(16, OUTPUT); // A2
pinMode(17, OUTPUT); // E1
pinMode(18, OUTPUT); // E2
for (int y = 14; y < 17;y++){
digitalWrite(ledBlock,LOW);
}
Serial.begin(9600);
//Unset clear (MR)
digitalWrite(9, HIGH);
//Pull chipselect E to LOW
digitalWrite(17, LOW);
digitalWrite(18, LOW);
}
void loop() {
//digitalWrite(i, !digitalRead(i));
for (int thisPin = 0; thisPin < 128; thisPin++) {
for (int bitje = 2; bitje < 9; bitje++){
digitalWrite(bitje, bitRead(thisPin,bitje-2));
}
//chip select
digitalWrite(14, bitRead(ledBlock,0));
digitalWrite(15, bitRead(ledBlock,1));
digitalWrite(16, bitRead(ledBlock,2));
digitalWrite(17, HIGH);
digitalWrite(17, LOW);
//delay(25);
}
if (ledBlock == 5) {
ledBlock = 0;
digitalWrite(9,LOW);
//delay(100);
digitalWrite(9,HIGH);
}else{
ledBlock++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment