X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=shift_register%2Fshift_register_pattern%2Fshift_register_pattern.ino;fp=shift_register%2Fshift_register_pattern%2Fshift_register_pattern.ino;h=0000000000000000000000000000000000000000;hb=2e29cbe13965809a5d3866ccdc12b1d665b54115;hp=d59a2962e0020bf071331c02446105579457598d;hpb=11eb80579bf2e63a8244897614542c917f641a47;p=sketchbook_andrea diff --git a/shift_register/shift_register_pattern/shift_register_pattern.ino b/shift_register/shift_register_pattern/shift_register_pattern.ino deleted file mode 100644 index d59a296..0000000 --- a/shift_register/shift_register_pattern/shift_register_pattern.ino +++ /dev/null @@ -1,52 +0,0 @@ -/* SuperCar like pattern with a shift register. - Note: first bit/LED is supposed to be 0 and not 7 - as in many arduino example sketches. - - Turning on the outputs of a 74HC595 using an array - - Hardware: - * 74HC595 shift register - * LEDs attached to each of the outputs of the shift register - */ - -int clockPin = 12; //IC Pin 11, Yellow Jumper -int dataPin = 11; //IC Pin 14, Blue Jumper -int latchPin = 8; //IC Pin 12, Green Jumper - -byte patterns[30] = { - B00000001, 100, - B00000010, 100, - B00000100, 100, - B00001000, 100, - B00010000, 100, - B00100000, 100, - B01000000, 100, - B10000000, 100, - B01000000, 100, - B00100000, 100, - B00010000, 100, - B00001000, 100, - B00000100, 100, - B00000010, 100 -}; - -int index = 0; -int count = sizeof(patterns) / 2; - -void setup() { - pinMode(latchPin, OUTPUT); - pinMode(clockPin, OUTPUT); - pinMode(dataPin, OUTPUT); -} - -void loop() { - digitalWrite(latchPin, LOW); - shiftOut(dataPin, clockPin, MSBFIRST, patterns[index * 2]); - digitalWrite(latchPin, HIGH); - delay(patterns[(index * 2) + 1]); - index++; - if (index >= count){ - index = 0; - } -} -