2.BitBang-Blink
This example demonstrates the use of shift registers as if they were just normal IO pins. This version uses bit-banging to drive the shift register. You should probably be using the SPI version instead.
- Boards:
- AVR, AVR USB, Nano Every, Nano 33 IoT, Nano 33 BLE, UNO R4, Pi Pico, Due, Teensy 3.x, ESP8266, ESP32
Connections
- 10: 74HC595 ST_CP
- 11: 74HC595 DS
- 13: 74HC595 SH_CP
Connect an LED (and series resistor) between the first output of the shift register and ground.
Remember to connect the enable pin the shift register to ground and the master reset pin to Vcc in order to enable it.
Behavior
This sketch will blink the LED once a second.
Written by PieterP, 2018-09-01 https://github.com/tttapa/Arduino-Helpers
const pin_t latchPin = 10;
const pin_t dataPin = 11;
const pin_t clockPin = 13;
void setup() {
sreg.begin();
}
void loop() {
delay(500);
delay(500);
}
constexpr PinStatus_t LOW
constexpr PinStatus_t HIGH
constexpr PinMode_t OUTPUT
Dummy header file for Arduino builder.
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
pin_t pin(pin_t pin) const
Get the extended IO pin number of a given physical pin of this extended IO element.
A class for serial-in/parallel-out shift registers, like the 74HC595.
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
A namespace with alternatives to the standard Arduino IO functions that can be used with extended IO ...