5. Potentiometer

Mount the following electrical schematic on a breadboard.

Esquema eléctrico de placa Arduino con un potenciómetro y dos ledes Montaje en protoboard de placa Arduino con un potenciómetro y dos ledes

Electrical circuit in Fritzing format


Exercises

  1. Upload the following program to the Arduino UNO board. The red LED will light up more or less depending on whether the potentiometer is turned to the right or to the left.

    Código del programa para Arduino que hace que se encienda más o menos un led dependiendo del giro de un potenciómetro
  2. Upload the following program to the Arduino UNO board. The red led and the green led will light alternately with a frequency that will depend on the position of the potentiometer.

    Turn the potentiometer to the right and to the left to see the effect it has on the leds.

    Código del programa para Arduino que hace que se enciendan alternativamente dos ledes con mayor o menor frecuencia dependiendo del giro de un potenciómetro
  3. Upload the following program to the Arduino UNO board.

    By turning the potentiometer in one direction, the two leds will turn off.

    When turning the potentiometer in the opposite direction, the green led will first light up to indicate that the value is greater than zero.

    If we continue turning the potentiometer, the red led will light up to indicate that we have reached the end of the journey.

    ../_images/arduino-proto-05-code03.png