We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e621e71 commit 11b571dCopy full SHA for 11b571d
ports/stm/boards/swan_r5/tests/pwnio.py
@@ -0,0 +1,18 @@
1
+import time
2
+import pwmio
3
+
4
5
+def fade(pin):
6
+ led = pwmio.PWMOut(pin, frequency=5000, duty_cycle=0)
7
+ # LED setup for QT Py M0:
8
+ # led = pwmio.PWMOut(board.SCK, frequency=5000, duty_cycle=0)
9
10
+ while True:
11
+ for i in range(100):
12
+ # PWM LED up and down
13
+ if i < 50:
14
+ led.duty_cycle = int(i * 2 * 65535 / 100) # Up
15
+ else:
16
+ led.duty_cycle = 65535 - int((i - 50) * 2 * 65535 / 100) # Down
17
+ time.sleep(0.01)
18
0 commit comments