Created
December 20, 2018 20:16
-
-
Save getelectronics/9f724f55194b0c800b246e28553acc4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
#The output pin | |
GPIO_PIN = 21 | |
GPIO.setup(GPIO_PIN, GPIO.OUT) | |
pwm = GPIO.PWM(GPIO_PIN, 500) | |
pwm.start(50) | |
# The program will wait for the input of a new frequency. | |
try: | |
while(True): | |
print "----------------------------------------" | |
print "Current frequency: %d" % 500 | |
Frequency = input("Please input a new frequency (50-5000):") | |
pwm.ChangeFrequency(Frequency) | |
except KeyboardInterrupt: | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment