From 706e4118fe25ad3289f20ae1c85861591d404853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BC=80=E6=99=BA?= Date: Sun, 27 Oct 2019 15:03:25 +0800 Subject: [PATCH] light example for light shield --- scripts/examples/33-Light-Shield/light.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 scripts/examples/33-Light-Shield/light.py diff --git a/scripts/examples/33-Light-Shield/light.py b/scripts/examples/33-Light-Shield/light.py new file mode 100644 index 000000000..0849d46bc --- /dev/null +++ b/scripts/examples/33-Light-Shield/light.py @@ -0,0 +1,9 @@ +import time +from pyb import Pin, Timer + +# 50kHz pin6 timer2 channel1 +light = Timer(2, freq=50000).channel(1, Timer.PWM, pin=Pin("P6")) +light.pulse_width_percent(100) # adjust light 0~100 + +while (True): + time.sleep(1000)