Answer the question
In order to leave comments, you need to log in
How to write the code to control the shift register using arduino?
How to correctly write code to control shift registers, LED drivers and any other radio components that are controlled using Clock and data input signals.
From what I have already found:
1. just manually enter the sequence of turning on and off the two arduino ports.
void loop() {
digitalWrite(pin2, HIGH);
delay(timer);
digitalWrite(pin2, LOW);
delay(timer);
digitalWrite(pin3, HIGH);
delay(timer);
digitalWrite(pin3, LOW);
delay(timer);
digitalWrite(pin4, HIGH);
delay(timer);
digitalWrite(pin4, LOW);
delay(timer);
digitalWrite(pin5, HIGH);
delay(timer);
digitalWrite(pin5, LOW);
delay(timer);
digitalWrite(pin6, HIGH);
delay(timer);
digitalWrite(pin6, LOW);
delay(timer);
digitalWrite(pin7, HIGH);
delay(timer);
digitalWrite(pin7, LOW);
delay(timer);
digitalWrite(pin6, HIGH);
delay(timer);
digitalWrite(pin6, LOW);
delay(timer);
digitalWrite(pin5, HIGH);
delay(timer);
digitalWrite(pin5, LOW);
delay(timer);
digitalWrite(pin4, HIGH);
delay(timer);
digitalWrite(pin4, LOW);
delay(timer);
digitalWrite(pin3, HIGH);
delay(timer);
digitalWrite(pin3, LOW);
delay(timer);
}
void loop() {
for (count=0;count<6;count++) {
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
Answer the question
In order to leave comments, you need to log in
In general, shift registers are perfectly controlled using the shiftOut function.
And your code is incomprehensible at all, especially the first one - the shift register is connected to three ports, and you have 6 ports there.
For conventional shift registers, for example, here, via ShiftOut: http://wiki.amperka.ru/abstract-arduino:press-counter
If the principle itself is important, then look at the timing diagrams, or unpick this function.
I could be wrong, but like: set the level to data, put it into the register at the clock front, set the following, push it into the register again with the clock front, after clogging all 8 values, apply the required level to the latch, which will simultaneously set all clogged values at the output register.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question