Problems with PIN Extender
Posted: Mon Oct 08, 2018 1:15 pm
Hey! I am trying to use a 74HC165 to get more INPUT pins on my esp8266.
I have connected everything according to the data sheet, but I still get all zeroes when pulling the values.
I have all 8 "D"-pins on the 74HC165 connected to GND using 10k resistors. Then one of the Pins to a button that pulls it to VCC. Pushing the button has no effect
Here is my code:
I have also attached a picture of my wiring. What am I doing wrong?
I have connected everything according to the data sheet, but I still get all zeroes when pulling the values.
I have all 8 "D"-pins on the 74HC165 connected to GND using 10k resistors. Then one of the Pins to a button that pulls it to VCC. Pushing the button has no effect
Here is my code:
Code: Select all
#include <Arduino.h>
#include <SPI.h>
byte shift_1;
void setup() {
Serial.begin(9600);
SPI.setClockDivider(SPI_CLOCK_DIV2);
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
SPI.begin();
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
}
void loop() {
digitalWrite(4, LOW);
shift_1 = SPI.transfer(0);
digitalWrite(4, HIGH);
Serial.print(micros());
Serial.print(" Register 1 = ");
Serial.println(shift_1, BIN);
delay(1000);
}
I have also attached a picture of my wiring. What am I doing wrong?