sfranzyshen.org

🚦Example of using the 74HC165 Shift Register within the ESP8266 Arduino Environment.

View the Project on GitHub sfranzyshen/74HC165-ESP8266

🚦74HC165-ESP8266

Example of using the 74HC165 Shift Register within the ESP8266 Arduino Environment.

Hardware

Example performed using a NodeMCU v 1.0 ESP-12 variant. It should work with other ESP8266 hardware with changes to the gpios.

Arduino IDE

Development environment used arduino-1.8.6-windows with the esp8266-Arduino-2.5.0-beta2 board extention installed.

Code (Sketches)

There are two different code sketches. One that uses the ShiftIn() function (bitbang) and the other that uses the esp8266’s hspi (hardware) interface. The hspi is far faster and should be the perfered method. But, where spi isn’t available or used for another purpose (sdcard) the bitbang method is still very good (160MHz) and useable. Additionally, there is an example to demonstrate hardware driven interrupt. I personally feel with the speed available polling the register with every loop or using a software interrupt or even a millis() variable and then comparing the last read with the current read to determin if a button was pressed works best … eliminating the need for the extra gpio. However, I includ it as a demostration of using SPI & hardware interrupts …

Schematic & Pinout

Schematic Hardware Interrupt

References