Goeduhub:- AI, ML, HADOOP, Python and IOT Training provider.
Register for Free Certified Workshop on AI & Machine Learning :: 26-01-2020 || Career options for aspiring CS/IT, ECE, EE or EIC or EEE Engineers
0 like 0 dislike
12 views

1 Answer

0 like 0 dislike
by (6.7k points)
selected by
 
Best answer

Hardware requirement and connections:

Hardware requirement and connections are same as explained in 

Turning on and off LED with your Raspberry Pi's GPIO Pins

LED to Raspberry-PI_IOT-Training-in-Jaipur

Python program

import RPi.GPIO as GPIO # Importing RPi library to use the GPIO pins

from time import sleep # Importing sleep from time library

led_pin = 21 # Initializing the GPIO pin 21 for LED

GPIO.setmode(GPIO.BCM) # We are using the BCM pin numbering

GPIO.setup(led_pin, GPIO.OUT) # Declaring pin 21 as output pin

pwm = GPIO.PWM(led_pin, 100) # Created a PWM object

pwm.start(0) # Started PWM with 0% duty cycle

while 1: # Loop will run forever

          for x in range(100): # This Loop will run 100 times

                    pwm.ChangeDutyCycle(x) # Change duty cycle

                    sleep(0.01) # Delay of 10mS

          for x in range(100,0,-1): # Loop will run 100 times; 100 to 0

                    pwm.ChangeDutyCycle(x)

                    sleep(0.01)

pwm.stop() # Stop the PWM

GPIO.cleanup() # Make all the output pins LOW

|| New Year Discount on summer training-2020 ||

20% OFF | on all summer training courses

|| Offer valid till 31-JAN-2020 (Extended Date) ||

Courses & Fee

  1. Augmented Reality & Virtual Reality - INR 15000/-
  2. AI, ML & Deep Learning - INR 12000/-
  3. Robotic Process Automation (RPA) - INR 12000/-
  4. Big Data HADOOP - INR 12,000/-
  5. Internet of Things (IoT) - INR 10,000/-
  6. Web development using python (Django) - INR 8000/-
  7. Industrial Automation (PLC-SCADA) - INR 8000/- 

Limited time offer !! Hurry up!!

[[ CALL - 07976731765 ]]

Register for Training

 Go to your Branch CSE or IT | ECE | EE, EIC or EEEMECE
 Know About Popular Colleges/Universities  List of IITsList of NITs | RTU-KOTA | Manipal University-Jaipur | JECRC University | Amity University Jaipur | BIT Mesra-Jaipur | MODY UNIVERSITY | LNMIIT-Jaipur | JK Lakshmipat | Banasthali Vidyapith | POORNIMA University
 Exams:   List of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG) | JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs
Placements:  List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Online Free Training:  Artificial Intelligence(AI) & Machine Learning | Python Programming | Internet of Things-IoT | OpenCV (Open Source Computer Vision Library) | LINUX | Big Data : Hadoop | 
 Goeduhub
About Us | Contact Us   Social::   |  | 
...