PWM based LED Brightness control using Raspberry Pi

Call for Price

PWM based LED Brightness control using Raspberry Pi

SKU: PWM based LED Brightness control using Raspberry Pi Category:

Description

ABSTRACT

Python programming in Raspberry Pi, which you can control the LED Brightness using PWM on the GPIO Pins. As Raspberry Pi beginners you will learn how to use PWM for the GPIO pins of Raspberry Pi, This project makes you control the LED Brightness using PWM by increasing and decreasing the Brightness of a LED

HARDWARE REQUIRED

  • Raspberry Pi
  • SD card
  • Power supply
  • VGA to HDMI converter (Optional)
  • LED

 

SOFTWARE REQUIRED

  • Raspbian Stretch OS      
  • SD card Formatter
  • Win32DiskImager (or) Etcher

PYTHON LIBRARIES USED

  • RPi.GPIO as GPIO (To access the GPIO Pins of Raspberry Pi)
  • Time library (For Time delay)

CODE

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(21,GPIO.OUT)
p=GPIO.PWM(21,50)
p.start(0)
while True:
    for i in range(0,101,2): #Increase in Brightness
        p.ChangeDutyCycle(i)
        time.sleep(.1)
    for i in range(100,-1,-2): #Fading in Brightness
        p.ChangeDutyCycle(i)
        time.sleep(.1)

Additional information

Weight 0.000000 kg

Reviews

There are no reviews yet.

Be the first to review “PWM based LED Brightness control using Raspberry Pi”

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.