LED reacting to specific frequencies.

Hey guys, im fairly new to arduino coding, i just finished making song of storms using a potentiometer, speaker and obviously the arduino, i used the 'tone' function to generate each note. i am trying to figure out how to make an led in a seperate pin to light when a specific note is sent to the speaker.

eg. Note A octave 4 is played, witch has a frequency of 440Hz, i want to have an led emit light when this note is sent.

PS The only way i know of doing it is to set each value of the LED to be either high or low after each note.

Thank you. :slight_smile:

VisionedAndrew:
Hey guys, im fairly new to arduino coding, i just finished making song of storms using a potentiometer, speaker and obviously the arduino, i used the 'tone' function to generate each note. i am trying to figure out how to make an led in a seperate pin to light when a specific note is sent to the speaker.

eg. Note A octave 4 is played, witch has a frequency of 440Hz, i want to have an led emit light when this note is sent.

PS The only way i know of doing it is to set each value of the LED to be either high or low after each note.

Sounds like a good way to do it, alright.

Let us know how it works out.

I was hoping that there might be an easier way of doing it

VisionedAndrew:
I was hoping that there might be an easier way of doing it

Easier than what? Turn on the LED before you turn on the note and turn it off before you stop the. It sounding what can be easier than that?

Grumpy_Mike:

VisionedAndrew:
I was hoping that there might be an easier way of doing it

Easier than what? Turn on the LED before you turn on the note and turn it off before you stop the. It sounding what can be easier than that?

Wouldn't running an FFT on the tone and then turning the appropriate LED on be a lot easier?

<j/k of course> :slight_smile:

VisionedAndrew:
I was hoping that there might be an easier way of doing it

Seriously?

You generate the note, right?
You know what note you are sending with tone(), right?
You know where your LED is connected, right?
Just before you play the note that you want to indicate, you light up the LED.
Just after you stop playing that note, you turn the LED off.

It's not rocket surgery.

Perhaps we are missing something that you didn't mention, so you can start by posting the code you use to play the song.