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.
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.
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.