Hello,
I have an arduino UNO, an ethernetshield ( I believe it's the new one ) sitting on top and two daisy chained 595 shift registers. Now the problem I've encountered is that it would seem the shift registers need to be connected to SPI ports 10 and up or it won't work. By this I mean I tried connecting my shift registers to port 2, 6 and 7 to be sure they would not conflict with the ethernet ports used by the shield ( 4,10,11,12,13 ) but even if I am not running any ethernet code the shift registers do not work ( anymore they used too not sure if all my fiddling around could have damaged them ? )
Long story short,I am new at this and the real question is how can I interface the shift registers and the ethernet shield ? Or an alternate is how can I have the ethernet shield ( or any other shield as I have a GPS one staring at me ) and drive multiple LEDs individually ?
Thank you for any help and or pointers,
/me
the code for the shift registers :
//**************************************************************//
// Name : shiftOutCode, Hello World
// Author : Carlyn Maw,Tom Igoe, David A. Mellis
// Date : 25 Oct, 2006
// Modified: 23 Mar 2010
// Version : 2.0
// Notes : Code for using a 74HC595 Shift Register //
// : to count from 0 to 255
//****************************************************************
//Pin connected to ST_CP of 74HC595
int latchPin = 2;
//Pin connected to SH_CP of 74HC595
int clockPin = 6;
////Pin connected to DS of 74HC595
int dataPin = 7;
void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
//Serial.println("reset");
//shiftOut(dataPin, clockPin, MSBFIRST, B1);
//Serial.println("test");
}
byte data2 = B00100000;
byte data1 = B00000001;
// data seems be pushed forward so data2 is sent before data1 to get to the leds
void loop() {
//registerWrite(8, HIGH);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, data2); //shifting out first byte
shiftOut(dataPin, clockPin, LSBFIRST, data1);
digitalWrite(clockPin, LOW);
digitalWrite(latchPin, HIGH);
Serial.println("working !");
}
PS :
I did do my homework
- /en/Tutorial/ShiftOut : but changing the pins doesn't help
- I saw this : /cgi-bin/yabb2/YaBB.pl?num=1293304349/15 ... and I am not sure how I can wire up a 4x4 led grid ( where to put the resistors and how to connect it to the arduino, as I've seen the cube too from Make ) and I'd like to have the shift registers work it looks simpler ...