You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
682 B
28 lines
682 B
import sys
|
|
from gpiozero import PWMLED
|
|
from gpiozero.pins.pigpio import PiGPIOFactory
|
|
from signal import pause
|
|
from time import sleep
|
|
|
|
#If you are working on MacOS or linux make an ssh tunnel first:
|
|
#ssh -L 8888:localhost:8888 kanelbulle
|
|
factory = PiGPIOFactory(host='localhost')
|
|
|
|
#If you are working on Windows:
|
|
#first ask Roel to open a port in the interaction.tools firewall for you
|
|
#then
|
|
#factory = PiGPIOFactory(host='kanelbulle.interaction.tools', port=8889)
|
|
|
|
led = PWMLED(17, pin_factory=factory)
|
|
|
|
while True:
|
|
try:
|
|
for i in range(0,10):
|
|
a = float(i/10)
|
|
led.value = a
|
|
sleep(0.1)
|
|
print(a)
|
|
except KeyboardInterrupt:
|
|
led.close()
|
|
sys.exit()
|
|
|
|
|