Update testaukset.py
This commit is contained in:
@@ -4,6 +4,13 @@ from grove.gpio import GPIO
|
|||||||
led = GPIO(5, GPIO.OUT)
|
led = GPIO(5, GPIO.OUT)
|
||||||
button = GPIO(6, GPIO.IN)
|
button = GPIO(6, GPIO.IN)
|
||||||
|
|
||||||
|
# create PWM instance
|
||||||
|
pwm = GPIO.PWM(12, 10) # pin 12
|
||||||
|
pwm.start(0)
|
||||||
|
# 1000 Hz sound
|
||||||
|
pwm.ChangeFrequency(1000)
|
||||||
|
pwm.ChangeDutyCycle(100)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if button.read():
|
if button.read():
|
||||||
led.write(1)
|
led.write(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user