atmel 168 problem?

I'm hoping this will be an easy question :

I am running a little program on an arduino to flash some leds randomly. This works fine on my arduino board with an atmel 8. I ordered two new arduini from Sparkfun and they came with atmel 168 and now my code doesn't work. I am sure this is a problem with the new boards as I am running the exact same program, just picking up the breadboard shield and moving from the atmel 8 to the atmel 168... then it doesn't work. Here is the code, changed just a bit from the example: is there a change I need to make for these new boards?

//**************************************************************//
// Name : shiftOutCode, Hello World //
// Author : Carlyn Maw,Tom Igoe //
// Date : 25 Oct, 2006 //
// Version : 1.0 //
// Notes : Code for using a 74HC595 Shift Register //
// : to count from 0 to 255 //
//****************************************************************

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
int time;
long randNumber;
long srandNumber;

void setup() {
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}

void loop() {
time = millis();
randomSeed(time);
// return a random number from 0 - 300
randNumber = random(300);
srandNumber = random(300);
//ground latchPin and hold low for as long as you are transmitting
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, randNumber);
shiftOut(dataPin, clockPin, LSBFIRST, srandNumber);
//return the latch pin high to signal chip that it
//no longer needs to listen for information
digitalWrite(latchPin, HIGH);
delay(1200);
}

Another clue - the program starts to run correctly when I plug the usb connector into the board and computer. Frustrating...

Thanks for any help!

Carlos

Found a solution in another post - 10k resistor between rx and ground. For some reason this wasn't necessary on the atmel 8 arduino...

Carlos

Guess not. The program will now start but "hangs" after a few iterations, just freezes.

Anyone? I have a show opening in about 48 hours (of course I thought I could just plug the new arduino into a working circuit...), I'm getting a bit frantic...

Carlos

HI

when you upload, are you selecting "Atmega 168" under the Tools>Microcontroller menu of the Arduino Software?

Daniel

PS: where's your opening?

Yes, 168 selected... I did the following and it seems to work:

pulldown resistor on both rx and tx, 470uF capacitor on power supply.

There must be some kind of power sensitivity difference on the two? When I could get it to work it would freeze, and often it wouldn't work until I plugged in the usb cable. Any thoughts on what it might be?

Opening is at Sculpture Space in Utica NY

thanks,

Carlos

sounds like a noisy power supply cause by rapid switching of the 595. Try also putting a .1uf capacitor across the 595 power pins.
Good luck with your show!

D

Carlos, I've heard that the pulldown resistor value is 100k, not 10k... Maybe this is still your problem?