Introduction: Arduino Interrupt - LED Brightness

Picture of Arduino Interrupt - LED Brightness

This project is an example of using Arduino interrupts. The interrupt will read the value from the potentiometer and set the LED to the set brightness.

Step 1: Connect the Arduino and Breadboard Power

Picture of Connect the Arduino and Breadboard Power

Connect the ground pin to the ground rail and the 5v pin to the power rail.

Step 2: Connect the Button

Picture of Connect the Button

  1. Wire the top-left corner of the button to the 5v rail on the breadboard.
  2. Wire the top-right corner to a 10kΩ resistor and that to the ground rail.
  3. Wire the bottom-right corner to pin 2 on the Arduino board.

Step 3: Connect the LED

Picture of Connect the LED

  1. Wire the LED anode to a 220Ω resistor and that to pin 9 on the Arduino board.
  2. Wire the LED cathode to the ground rail on the breadboard.

Step 4: Connect the Potentiometer

Picture of Connect the Potentiometer

  1. Wire one of the two legs to the power rail and the other to the ground rail.
  2. Wire the other pin to pin A0 on the Arduino board.

Step 5: Upload the Code

Once the code is uploaded, set the potentiometer to the specified brightness level and press the button to update the LED.

Comments

BrownDogGadgets (author)2017-10-26

Can you give some more explanations about HOW you would use this, or a video of it in action? Good write up but lacking some description.

beno754 (author)BrownDogGadgets2017-10-30

Hi BDG, I agree with your comment, but for your answer:

if you look at the sketch for arduino, the loop function has no conditions about the button press, it is simply an infinite loop of writing value.

the interupt [interupts and infinite loop] providing a new value to be set on the LED. Hope it clears a few things up.

About This Instructable

346views

9favorites

License:

More by carmackj:Arduino Interrupt - LED BrightnessArduino Battery CheckerLab 1 - 2 LEDs
Add instructable to: