I have a block of 8 dip switches that are connected to pins 0-7 on my arduino uno and connected with 10k resistors to ground. When I do a digitalRead to the pins I get back seemingly random results. I expected to get digitalRead(pin) == HIGH when the switch was in the on position. The switches seem to be ok, is my setup wrong? I was using the button tutorial from this site as my guide.
Second, can I use the 74HC595 IC to read multiple switches or is it only for output? The ShiftIn tutorial mentions CD4021B is this my best option? If so is this the right thing? CD4021B: Major Brands : IC CD4021 8-Stage Static Shift Register : ICs & Semiconductors it doesn’t have the B on the end, but the description seems rightish.