/*
looking at plug of narrow strip of leds
with plug gaps on the bottom count back right as 1, right of that as 2 to 10
then front right as 11 right of that as 12 right as 13 to 20
wire a long strip up with pin 1 live pin 2 gnd pin 13 to D8 pin 14 to D12
pin 15 to D11 and pin 16 to vcc*/
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
byte led5[5] = {0,0,4,0,0};
byte led6[5] = {0,0,8,0,0};
byte led7[5] = {0,0,16,0,0};
byte led8[5] = {0,0,32,0,0};
byte led9[5] = {0,0,64,0,0};
byte led10[5] = {0,0,128,0,0};
byte led11[5] = {0,0,0,0,1};
byte led12[5] = {0,0,0,0,2};
byte led13[5] = {0,0,0,0,4};
byte led14[5] = {0,0,0,0,8};
byte led15[5] = {0,0,0,0,16};
byte led16[5] = {0,0,0,0,32};
byte led17[5] = {0,4,0,0,0};
byte led18[5] = {0,8,0,0,0};
byte led19[5] = {0,0,0,0,64};
byte led20[5] = {0,0,0,0,128};
byte led21[5] = {0,0,0,1,0};
byte led22[5] = {0,0,0,2,0};
byte led23[5] = {0,16,0,0,0};
byte led24[5] = {0,32,0,0,0};
byte led25[5] = {0,64,0,0,0};
byte led26[5] = {0,128,0,0,0};
byte led27[5] = {0,0,0,4,0};
byte led28[5] = {0,0,0,8,0};
byte led29[5] = {0,0,0,16,0};
byte led30[5] = {0,0,0,32,0};
byte led31[5] = {1,0,0,0,0};
byte led32[5] = {2,0,0,0,0};
byte led33[5] = {4,0,0,0,0};
byte led34[5] = {8,0,0,0,0};
byte led35[5] = {0,0,0,64,0};
byte led36[5] = {0,0,0,128,0};
byte led37[5] = {0,0,1,0,0};
byte led38[5] = {0,0,2,0,0};
byte led39[5] = {16,0,0,0,0};
byte led40[5] = {32,0,0,0,0};
//int a = 0;
byte b[5] = {1,2,3,4,5};
int c = 4;
int d = 0;
int e = 1;
int f = 0;
int g = 0;
int h = 0;
int i = 0;
//int j = 0;
byte myLEDsLen = 5;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop()
{
//pin5();
//for (int x=5;x < 9; x++)
//{
//pin(led(x));
//}
pin(led5);
pin(led6);
pin(led7);
pin(led8);
pin(led9);
pin(led10);
pin(led11);
pin(led12);
pin(led13);
pin(led14);
pin(led15);
pin(led16);
pin(led17);
pin(led18);
pin(led19);
pin(led20);
pin(led21);
pin(led22);
pin(led23);
pin(led24);
pin(led25);
pin(led26);
pin(led27);
pin(led28);
pin(led29);
pin(led30);
pin(led31);
pin(led32);
pin(led33);
pin(led34);
pin(led35);
pin(led36);
pin(led37);
pin(led38);
pin(led39);
pin(led40);
//pincheck();
//pincheck2();
//pincheck3();
}
void pin( byte myLEDs[])
{
digitalWrite(clockPin, LOW);
for (byte j=0; j < 5; j++)
// for (byte j = 0; c < 5; c++)
{
shiftOut(dataPin, clockPin, MSBFIRST, myLEDs[j]);
Serial.print (myLEDs[j]);
Serial.print (" ");
Serial.println (j);
}
delay(30);
digitalWrite (latchPin,HIGH);
digitalWrite (latchPin,LOW);
delay(100);
}
//64,128 on first line does nothing
//1,2 on second line does nothing
void pincheck()
{
digitalWrite(clockPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 4);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
delay(300);
digitalWrite (latchPin,HIGH);
digitalWrite (latchPin,LOW);
delay(100);
}
void pincheck2()
{
digitalWrite(clockPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 2);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
delay(300);
digitalWrite (latchPin,HIGH);
digitalWrite (latchPin,LOW);
delay(100);
}
void pincheck3()
{
digitalWrite(clockPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 64);//feeds first chip
shiftOut(dataPin, clockPin, MSBFIRST, 0);//feeds first chip
delay(300);
digitalWrite (latchPin,HIGH);
digitalWrite (latchPin,LOW);
delay(100);
}
this is the whole thing, still not finished, I would like to replace all the lines
pin(led5);
pin(led6);
pin(led7);
pin(led8);
pin(led9);
pin(led10);
pin(led11);
pin(led12);
pin(led13);
etc with a for loop something like
for (int x=5;x < 9; x++)
{
pin(led(x));
}
but I can't find the correct format.