int datapin1 = 3;
int datapin2 = 9;
int latchpin1 = 5;
int latchpin2 = 10;
int clockpin1 = 6;
int clockpin2 = 11;
byte vcc = 0b11111111;
byte gnd = 0b00000000;
void setup() {
// put your setup code here, to run once:
pinMode(datapin1, OUTPUT);
pinMode(datapin2, OUTPUT);
pinMode(latchpin1, OUTPUT);
pinMode (latchpin2,OUTPUT);
pinMode(clockpin1, OUTPUT);
pinMode(clockpin2, OUTPUT);
}
void loop() {
vcc1 ();
delay(30);
vcc2 ();
delay(5);
gnd1 ();
}
void vcc1 ()
{
digitalWrite(latchpin1, LOW);
shiftOut(datapin1,clockpin1,LSBFIRST,vcc);
digitalWrite(latchpin1, HIGH);
vcc= vcc/ 128 + vcc*2;
delay(5);
}
void vcc2( )
{
digitalWrite(latchpin1, LOW);
shiftOut(datapin1,clockpin1,LSBFIRST,vcc );
digitalWrite(latchpin1, HIGH);
}
void gnd1 ()
{
digitalWrite(latchpin2, LOW);
shiftOut(datapin2,clockpin2,MSBFIRST,gnd);
digitalWrite(latchpin2, HIGH);
gnd = gnd/128+gnd*2;
delay(5);
gnd = gnd + 1;
delay(5);
gnd = ~gnd ;
}