Arduino: Project 26: LED brightness indicator

So in this project I’ve built a LED brightness indicator using a LCD screen.

Hello everyone!! Welcome to this post on Arduino Projects!!
Need a short introduction to what the Arduino is then click on LINK
Check out the breadboard intro right HERE

Demo:

Things Required:

  1. Jumper Wires
  2. Arduino UNO
  3. LED
  4. 330 ohm resistors
  5. 10 k potentiometer (x2)
  6. 16×2 LCD Screen
  7. USB Cable
  8. Arduino IDE on computer

Reference Material:

Here’s a helpful link for the project: (LINK)

Code:

View on/ Download from Github: (LINK)

#include <LiquidCrystal.h>
int rs= 7;
int en= 8;
int d7= 9;
int d6= 10;
int d5= 11;
int d4= 12;

int led=6;
int potpin= A0;
int brightness;
int potval;
int indicator;

LiquidCrystal lcd(rs,en,d4,d5,d6,d7);

byte pBar[] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};

void setup() {
  pinMode(led, OUTPUT);
  pinMode(potpin, INPUT);
  lcd.begin(16,2);
  digitalWrite(led, LOW);
  lcd.createChar(0, pBar);
}

void loop() {
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(" LED BRIGHTNESS");
  potval=analogRead(potpin);
  brightness=(255.0/1023.0)*potval;
  analogWrite(led, brightness);
  indicator= (17.0/255.0)*brightness;
  lcd.setCursor(0,1);
  for(int i=0; i<indicator; i++){
    lcd.setCursor(i,1);
    lcd.write(byte(0));
  }

  delay(500);
  
}

Stay Tuned for upcoming posts on Arduino Projects! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

Happy Learning!!

This image has an empty alt attribute; its file name is stay-tuned.gif

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close