i attempted following the instructions on the ShiftOut page on the arduino site, and i just can't get it to work. I followed the schematic perfectly, double and triple checked it. I copied and pasted the code for all the examples, and i couldn't get any of them to work. I'm trying to light the 8 LEDs like it has in the examples. I've even replaced the 74HC595 chip. Any suggestions on troubleshooting? From GND to output of 74HC595, i'm getting like 1VDC or somewhere around there. It's not 0, but it's not enough to light the LED. Hopefully someone will be able to offer some troubleshooting advice beyond check your connections and your code (as i feel confident in both).
You did not explain what "does not work" mean. So, check your connections and your code.
Pick one of the code examples and work through what is happening there. (Saying "I tried them all and they didn't work" provides no helpful information.)
does not work means " From GND to output of 74HC595, i'm getting like 1VDC or somewhere around there. It's not 0, but it's not enough to light the LED."
The most simplistic example was this:
int latchPin = 8; //595 pin 12
int clockPin = 12; //595 pin 11
int dataPin = 11; //595 pin 14
//595 pin 16 has 5VDC
//595 pin 8 has GND
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
for (int numberToDisplay = 0; numberToDisplay < 256; numberToDisplay++) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);
digitalWrite(latchPin, HIGH);
delay(500);
}
}
the LEDs never light
You don't mention hooking up pins 13 and 10 of the SR. Be sure you have done this as well.
Also - check your resistor size.
From: http://www.arduino.cc/en/Tutorial/ShiftOut
Make the following connections:
GND (pin 8) to ground,
Vcc (pin 16) to 5V
OE (pin 13) to ground
MR (pin 10) to 5V
Sorry, i was going off of memory... I have it in front of me now.
Pins 1-7 and 15 are going from the pin to a 220 ohm resistor to the anode of the LED (seperate resistor and led for each pin). the cathode of each LED is going to a common ground connected to GND of the arduino.
Pin 8 is connected to arduino GND
Pin 9 is not connected
Pin 10 is connected to arduino 5VDC
Pin 11 is connected to clockPin (12) on the arduino
Pin 12 is connected to latchPin (8) on the arduino
Pin 13 is connected to arduino GND
Pin 14 is connected to dataPin (11) on the arduino
Pin 16 is connected to arduino 5VDC
Testing straight from GND to output pin of the 595 should i get 5VDC when it's on and 0VDC when it's off?
Yes, it should read 5v.
You can test the LED / resistor setup by connecting your LED/Resistor setup directly to the 5v and ground on the arduino.
Also.. this code (untested) should turn them all on:
int latchPin = 8; //595 pin 12
int clockPin = 12; //595 pin 11
int dataPin = 11; //595 pin 14
//595 pin 16 has 5VDC
//595 pin 8 has GND
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
digitalWrite(latchPin, HIGH);
delay(5000);
}
With that code, and disconnecting the LEDs, i tested from GND to the output pins of the 595.
595 pin - voltage
01 - 0
02 - 0
03 - 0
04 - 0
05 - 0
06 - 0
07 - 5
15 - 0
It appears that only pin 7 is getting triggered.
I got the same result with a different 595 chip.
Well... i just figured it out. Now i feel completely stupid. I assumed that the right chip was in the right drawer. Drawer had a couploe of 74HC165 chips in it.
The test code you supplied worked with the right chip (of course) so i'll try the examples again.
Sorry for the exercise in futility. Sometimes it's hard to read the numbers on the chips and i must have read what i wanted to read. Need to get my loupe magnifier back out for this very reason.
I assumed that the right chip was in the right drawer.
That is why I keep all my parts in a big pile on the kitchen counter (a joke, but I don't keep labelled drawers - you sound very organized).
Thanks for letting us know you got it. Looks like your on the right track.
I created a sample program that uses this chip but allows for PWM control. You may find it useful as well, here is a link.