-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shifting_LEDS.ino
65 lines (54 loc) · 1.44 KB
/
Shifting_LEDS.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Left Board
int clockPinA = 13;
int latchPinA = 12;
int dataPinA = 11;
// Right Board
int clockPinB = 10;
int latchPinB = 9;
int dataPinB = 8;
void setup() {
// put your setup code here, to run once:
pinMode(clockPinA, OUTPUT);
pinMode(latchPinA, OUTPUT);
pinMode(dataPinA, OUTPUT);
pinMode(clockPinB, OUTPUT);
pinMode(latchPinB, OUTPUT);
pinMode(dataPinB, OUTPUT);
}
// Square
byte moveGrounds[4] = {223, 239, 247, 251};
byte movePowers[4] = {15, 9, 9, 15};
void loop() {
// put your main code here, to run repeatedly:
for (int j=0; j<75; j++)
{
for (int x=0; x<4; x++)
{
digitalWrite(latchPinA, LOW);
shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[x]);
digitalWrite(latchPinA, HIGH);
digitalWrite(latchPinB, LOW);
shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[x]);
digitalWrite(latchPinB, HIGH);
delay(1);
digitalWrite(latchPinA, LOW);
shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
digitalWrite(latchPinA, HIGH);
digitalWrite(latchPinB, LOW);
shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
digitalWrite(latchPinB, HIGH);
}
}
for (int i=0; i<4; i++)
{
movePowers[i] = movePowers[i] * 2;
}
Serial.println(movePowers[3]);
if (movePowers[3]==0)
{
movePowers[0] = 15;
movePowers[1] = 9;
movePowers[2] = 9;
movePowers[3] = 15;
}
}