24 May 2011

Arduino UNO: Potentiometer used as a 10-way LED switch


Using similar principles as before, I have used a potentiometer (variable resistor) as an Analog input. I have mapped the value received from the potentiometer (0 to 1023) and converted the value to a number between 4 and 13, which represent the OUTPUT pins that light up the LEDs.

If you would like to see the sketch/code, let me know in the comments.

11 comments:

  1. LEDs are finding many applications especially as low energy light sources. LEDs can last thousands of hours if used at rated current levels.

    ReplyDelete
  2. Hey, I am doing something similar for a class. I'd love to see your code for this project.

    ReplyDelete
  3. Have a look at the Flex sensor and LED blog post. It should be similar.

    ReplyDelete
  4. The LED on PIN 8 and 13 only blink, then when I turn the knob, LED on Pins 7 and 12 light up, but no others. I'm not sure what I'm doing wrong here. Does it matter that I only use one GND pin instead of both on the POWER Block of the Arduino UNO?

    ReplyDelete
  5. Firstly cycle through each pin to make sure that each LED will actually light up. This will confirm that this part is working. As for the grounding, it is hard to know what you are doing without seeing it. Perhaps try to test the potentiometer to see what readings you are getting. Or try out the example from the Arduino Site: http://www.arduino.cc/en/Tutorial/Potentiometer

    ReplyDelete
  6. What is the code? Is it the same as the flex sensor code?

    ReplyDelete
  7. sir can i get ur codes? i need for my presentation in my class. thx.

    ReplyDelete
    Replies
    1. Use the search function on this blog - and search for Flex sensor.
      The code is essentially the same.

      Regards
      Scott

      Delete
  8. Hi I am new and I am looking for a full code for a single led fading with flex sensor as well as a visual description could you help me? :)

    ReplyDelete
    Replies
    1. I saw the same question on one of my other pages. See my response there.

      Delete

Feel free to leave a comment about this tutorial below.
Any questions about your particular project should be asked in the ArduinoBasics forum.

Comments are moderated due to large amount of spam.