(I hope I placed this right, in doubt between programming and this forum)
OK, so I'm getting along nicely with my Arduino Uno now, so I decided to stop fooling around with making 2 or 3 LED's blink, and plug that 595 chip in that I got with my pack. The tutorial was easy enough, just make sure you wire it up correctly, load the code, rock 'n roll.
But that's no fun! I want to do some stuff myself. So I got to playing around, but the only way I can get it to work, is by writing out the complete code, no easy tricks to make it do what I want it to do. So here it is: I want to make 8 LED's blink around in a certain pattern, for example: LED1 on, delay, LED1 off LED2 on, delay, etc. Now I can do this by writing out the individual pieces of the pattern easily enough. What I want to do is make it do it by itself, if at all possible. I've found some code examples but they do not do what I want, and I couldn't figure out how to adapt them(the "one by one" example from the tutorial section on this site, for instance, is one fixed sequence which does not make the LED's go blinky the way I want them to blinky).
Code example of what I have now (not the complete thing, that one is terribly long)
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00000001);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B10000000);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00000010);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B01000000);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00000100);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00100000);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00001000);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00010000);
digitalWrite(latch, HIGH);
delay(time);
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, B00001000);
digitalWrite(latch, HIGH);
delay(time);
and so on...
So questions: 1: Is there a shorter way of how to make it blink such a pattern? 2: If there is, how? 3: Is it possible to get 2 or more LED's on at the same time, using the method requested in question 2?
Thanks in advance. (If this question has been asked for thousands of times, I am terribly sorry but I could not find a way to use the register and make it do my thing).