How to make the LED react on input

Thanks, but when i upload it to the board, the green light just lightning up and, there's no reaction else. :cry: :cry:
I REALLY DONT KNOW WHATS WRONG :frowning: :frowning: :frowning:

What Grumpy Mike and Mem are trying to help you with is to print the values you are measuring out to the serial port. In order for you to see anything, you need to ask your computer to show you what the Arduino is sending it.

In the IDE (the software on your computer you use to send your programs to the Arduino) there is a row of buttons you must be using for this. There is one to compile, one to save and one to send the program to the Arduino. After that, last button on the right, there is one called serial monitor.

Try clicking on the serial monitor button just after you have sent Mem's code to your Arduino, and hopefully after a little wait you should see some numbers appearing in a new window. These numbers are the data measured by your Arduino.

Once this works, please tell us what those numbers are (an average value is fine, we don't need hundreds of samples).

Good luck!

thanks, BUT i dont know what i am doing wrong, because,when the i put the input in, the readen value i 0...
but when i take it out the numbers go to 200 to 300...
and when i take the microphones ground off, the numbers go to 1023...
is it my microphones connection, to the other components that is wrong

It's normal to get a floating value if there is nothing connected to the pin when you read it (i.e. when you disconnected your microphone), so that is nothing to worry about. Odd values in the absence of a ground connection are also normal.

If you have a potentiometer (a variable resistance with a knob you turn to change the value), you could try to connect one end of it to 5V, the other to ground (the same ground as your Arduino) and to put the middle connection (the one with the changing value) to your microphone input.

You should be able to see the value in the serial monitor, with Mem's code running, go from nearly 0 to nearly 1023 as you turn the knob.

If you do not have a potentiometer, you can try the same thing with various pairs of resistors in series... something called a voltage divider.

i wil be abel to try it out with a potentiometer on monday. but so far thank you :smiley: :wink:

You're welcome and good luck on Monday! :wink:

Hey again
I tryed it with a potentiometer, and i got it to work like i would like with the microphone, but when i connect the microphone again, and change the values, it doesn't work

Well, now we know that your circuit works to measure 0-5V signals.

This probably means that the signal from the microphone is too small relative to the 0-5V amplitude you are measuring, as Mike was saying earlier, I believe.

You will need to amplify it somehow. You should mention this to your professor as how to do this will depend on what parts you have available in class.

I have already amplified the signal, the level is now 0.2V. What do you suggest?

So the arduino measures 0-5V just fine with the potentiometer, and you know you have 0.2V at the amplified microphone, but when you connect the two, the arduino measures 0?

(going to lunch, by the way, so I won't be able to reply for a bit)

I have already amplified the signal, the level is now 0.2V.

Is this measurement taken before you connect it up to the Arduino's input or when it is connected up?

I suspect that the output of your amplifier is being killed by the arduino's input impedance. Have you connected this up through a capacitor like I said earlier or is it a direct connection? Have you connected the -ve supply on your amplifier to the GND on the arduino. Note that GND on the amplifier is NOT the same as GND on the Arduino if you are running it all off the same supply.

everybody, thanks for your help!!!
But my time is done, so i talked to my professor, about it. i choose to simulate it with a potentiometer instead. i've used too long time on this projekt...
so i close this post

Sorry to hear that, better luck on the next one!

I guess we all got an F on that project. >:(

It was proberbly something I did wrong...
But still thanks, for your help, because of that, i got to know a lot about the arduino, and i think, somehow I will score some more grades :slight_smile: :slight_smile: :slight_smile: :wink: :wink: :wink: :wink: :wink: :wink: ;)...

I thought I posted this in another thread on this forum...probably would have needed to tweak the amplification a little for the microphone, but it would do the trick:

This one looks a lot better signalwise, but the response really doesn't look as good as the simpler circuit when you actually build it.

ignore this post, wrong topic

int val = 0;

void setup()
{
 // note that you should not call pinMode for the analog pins
 Serial.begin(9600); // initialise serial port for 9600 baud
}

void loop()
 {

   val = analogRead(analogPin);   // read the input pin
   Serial.println(val,DEC);
   delay(250); // delay 1/4 second between readings
}

Would something like this work over the USB port? Would it give off results?

A microphone does not provide enough signal to drive the analog inputs without amplification. The circuit in the top picture in macegr's post above is an example of what is needed.