making LED and Piezo work simultaneously

I'm a total noob with the arduino and have never even attempted anything close to programming - the learning is slow-going. I have tried to look into making 8 LEDs blink one at a time in synchronization with a simple piezo buzzer. I'm not exactly sure how to write the code so it will work. I know that I have to use the if/else rule?? but i'm not sure how to execute that. Please forgive my lack of knowledge and terminology, but I trust you're all quite capable. The code I'm working with is under the cut w/ a pic of my breadboard set-up

Thanks in advance! -monti

int speakerPin = 5;

int ledPins[] = {13,12,11,10,9,8,7,6};

int length = 13;
char notes[] = "cdefgabCbafed";
int beats[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
int tempo = 50;

void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}

void playNote(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };

for (int i = 0; i < 8; i++) {
if (names == note) {
_ playTone(tones*, duration);_
_
}_
_
}_
_
}_
void setup() {
pinMode(speakerPin, OUTPUT);
*for(int i = 0; i < 8; i++){ *
_ pinMode(ledPins,OUTPUT);
}
}
void loop() {
for (int i = 0; i < length; i++) {
if (notes == ' ') {_

delay(beats _ tempo); // rest_

* } else {*
playNote(notes, beats * tempo);
* }*

* // pause between notes*
* delay(tempo / 2);*
}
int delayTime = 50;
for(int i = 0; i <= 7; i++){
* int offLED = i - 1;*
* if(i == 0) {*
* offLED = 7;*
* }*
_ digitalWrite(ledPins*, HIGH);
digitalWrite(ledPins[offLED], LOW);
delay(delayTime);
}
}_

*

Look at your code. In particular, look at this bit:

for (int i = 0; i < 8; i++) {
  if (names == note) {
    playTone(tones, duration);
  }
}

Is that what you wrote? I think it's not what you intended to post. I think that you intended the second line of that snippet to read like this:
 if (names[i] == note) {But, the index [ i ] is missing from your post in that position. Anyone who tries to compile your code will get a compilation error, and they'll have to troubleshoot it in order to test it. Many will just move on to the next post, and skip yours.

To learn how to keep your code from being garbled in this fashion, please read, "How to use this forum - please read," posted near the top of each section of the forum. In particular, please pay attention to item #7, "If you are posting code or error messages, use "code" tags."