Go Down

Topic: Dim LED with level Sensor (Read 1 time) previous topic - next topic

PaulS

Quote
Is the circuit I'm using as a reference is not the good one ?

It might be. In fact, it probably is.

But, the steps that you have taken to implement that circuit may not have been correct. So, you need to forget about the circuit for a moment, and describe what you have connected to what.

Like this:
I have a xx ohm resistor connected to +5V and analog pin x. I also have the sensor connected to analog pin and ground.

Or, if you have them connected in reverse order, that's fine, too.

But, we don't know how you have tried to follow the circuit.

We also don't know what values you are seeing in the Serial monitor after having added the statements I suggested.

Perhaps as you suggested earlier, you are simply using too large a resistor in the voltage divider circuit, so that the range of values read from the analog pin is too small to have a noticeable affect on the LED brightness. In which case you can either try a different resistor or change the mapping statement in the code.

To help you, though, you need to quit saying that you followed the circuit exactly, and say exactly what you did, and what values you are now seeing.

Plankton

Hi Paul,

Following your advice, I've tried to understand how to use the 'serial' function, but all tutorials are explaining different things so I'm not really sure about what to add exactly into the code.

I will try to experiment this overnight, and will let you know the result, ... if I have one  :-/

Anyway, I have to say, having problems is a really good way to discover things.

Thanks again.

Plankton

Dear Paul,

Sorry to come back to you so late  :(
Processing is fantastic, from that I was able to adjust the map value and make the sensor work.
Next step, being able to connect it to a Velleman K8064 to dim a 12V halogen bulb.
So exciting...
Will keep you updated and thank you so much for your advice.

Go Up