EasyManua.ls Logo

Elegoo Mega2560 - Page 168

Elegoo Mega2560
224 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
168
/
223
Bit' (LSB).
The last parameter is the actual data to be shifted into the shift register, which in
this case is 'leds'.
void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}
If you wanted to turn one of the LEDs off rather than on, you would call a similar
Arduino function (bitClear) with the 'leds' variable. This will set that bit of 'leds' to
be 0 and you would then just need to follow it with a call to 'updateShiftRegister' to
update the actual LEDs.
Example picture

Table of Contents