Control the brightness of a led by turning a potentiometer.

This tutorial is part of the Nairda learning path. You can build it step by step inside the app, which checks every block you place before letting you move on.


The steps

  1. We add a While loop, which repeats forever.
  2. We declare a led on pin 13.
  3. We declare a potentiometer called pot on analog pin 0.
  4. We create a number variable called reading.
  5. Inside the loop we put a delay of 100 milliseconds.
  6. Behind it we set reading to what the pot measures.
  7. Behind it we put the led and give it the variable reading.

When you finish, the app takes you straight to the next tutorial in the path.

Build it in Nairda