int datapin = 13;
int clockpin = 15;
int latchpin = 14;
byte data = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(datapin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(latchpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
//delay(10); // this speeds up the simulation
oneAfterAnother();
}
void shiftWrite(int desiredPin, boolean desiredState){
bitWrite(data, desiredPin, desiredState);
shiftOut(datapin, clockpin, MSBFIRST, data);
digitalWrite(latchpin, HIGH);
digitalWrite(latchpin, LOW);
}
void oneAfterAnother(){
int index;
int delayTime = 10000;
shiftWrite(index, HIGH);
delay(delayTime);
shiftWrite(index, LOW);
delay(delayTime);
shiftWrite(index+1, HIGH);
shiftWrite(index+2, HIGH);
/*
for(index = 0; index <= 7; index++){
shiftWrite(index, HIGH);
delay(delayTime);
}
for(index = 7; index >= 0; index--){
shiftWrite(index, LOW);
delay(delayTime);
}
*/
}