B4R Code Snippet SN74HC165 Shift Register for multi input

The SN74HC165 Shift Register enables connecting many buttons to the Arduino/ESP8266 using only 4 pins.
I used the data here http://playground.arduino.cc/Code/ShiftRegSN74HC165N to build and connect everything, and free-translated the sketch to B4R.
Instead of simple buttons I have used two 8-buttons devices which are just buttons put together with common ground. The connection of buttons here requires Vcc and pull-down resistors, unlike the usual way of open/ground so I connected the G pin to Vcc.
The author has forgotten to draw the power lines to Vcc pins of the SN74HC165.
The IC works with 5v or 3.3v so you don't need to shift voltage levels when using Wemos.

The only problem left is what to do with 16 buttons application...
buttons.png
 

Attachments

  • 165.zip
    1.2 KB · Views: 234
Last edited:
Top