Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # Use for PWM on /dev/bone/pwm/
- from pathlib import Path
- from PWMSone import Pwm # see https://pastebin.com/R70P1wAn
- from time import sleep
- pwm1b = Pwm('/dev/bone/pwm/1/b', frequency=50, value=0)
- pwm1a = Pwm('/dev/bone/pwm/1/a', frequency=50, value=0)
- GPIO = Path('/sys/class/gpio/gpio60/direction')
- GPIO.write_text('out')
- GPIO = Path('/sys/class/gpio/gpio60/value')
- GPIO.write_text('0')
- #GPIO1 = Path('/sys/class/gpio/gpio44/direction')
- #GPIO1.write_text('out')
- #GPIO1 = Path('/sys/class/gpio/gpio44/value')
- #GPIO1.write_text('0')
- # https://pastebin.com/R70P1wAn
- # initialize and enable pwm, automatically disable when scope is left
- #with Pwm('/dev/bone/pwm/1/b', frequency=20000, value=0) as pwm:
- # while True:
- # pwm.value = float(input("Enter PWM value (between 0.0 and 1.0): "))
- try:
- while True:
- port = float(input("Please type a 0 or a 1 : "))
- if port == 0:
- GPIO.write_text('1')
- sleep(1)
- frequency=150
- pwm1b.value=1.0
- sleep(1)
- elif port == 1:
- GPIO.write_text('1')
- sleep(1)
- frequency=70
- pwm1b.value=0.1
- sleep(1)
- except KeyboardInterrupt:
- GPIO.write_text("0")
- # GPIO1.write_text("0")
- pwm1b.enabled = False
- print("Kosher Salt!")
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement