Make GIU interface for PWM in Raspberry pi

You want to make an application to run on the Raspberry Pi that has a slider to control power to a device using PWM. Today I show you how to Make GIU interface for PWM in Raspberry pi

Required Component connect  LED Raspberry Pi :

1.Raspberry pi
 
 
 4.Resistors 
 
 

This book will help you to gain more knowledge of Raspberry pi  Software and Hardware Problems and Solutions

Raspberry Pi Cookbook

Circuit diagram connects LED Raspberry Pi:

shows how you can wire this LED using a solderless breadboard and male-to-female jumper leads

Connecting an LED to a Raspberry Pi

Code GIU PWM Raspberry pi:

from tkinter import *
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(12, GPIO.OUT)
pwm = GPIO.PWM(12, 500)
pwm.start(100)
class App:
     def __init__(self, master):
         frame = Frame(master)
         frame.pack()
         scale = Scale(frame, from_=0, to=100,
         orient=HORIZONTAL, command=self.update)
         scale.grid(row=0)
     def update(self, duty):
         pwm.ChangeDutyCycle(float(duty))
root = Tk()
root.wm_title('PWM Power Control')
app = App(root)
root.geometry("500x100+0+0")
root.mainloop()
When you run this Code you can see like this interface and a Python program that uses a slider to change the PWM duty cycle between 0 and 100 percent You will need to connect an LED or some other kind of output device to GPIO pin 12 that is capable of responding to a PWM signal. Using an LED  is the easiest option to start with
. PWM GUI Raspberry pi

If you want to know more about raspberry pi then click on the link below

RASPBERRY PI TUTORIALS FOR BEGINNERS

No comments

Theme images by Dizzo. Powered by Blogger.