From f45c6417c6a9e0fd75ddca32fdabc37c6c71ea76 Mon Sep 17 00:00:00 2001 From: Martin O'Hanlon Date: Thu, 2 Feb 2023 09:50:04 +0000 Subject: [PATCH] removed old code examples --- README.rst | 1 + examples/blink_onboard_led.py | 12 ----------- examples/color_dial.py | 29 -------------------------- examples/fade_onboard_led.py | 12 ----------- examples/motor.py | 14 ------------- examples/ultrasonic_distance_sensor.py | 8 ------- 6 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 examples/blink_onboard_led.py delete mode 100644 examples/color_dial.py delete mode 100644 examples/fade_onboard_led.py delete mode 100644 examples/motor.py delete mode 100644 examples/ultrasonic_distance_sensor.py diff --git a/README.rst b/README.rst index ebf7cc4..7709b4a 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,7 @@ Documentation is available at `picozero.readthedocs.io `_ - `Recipes and how-to's `_ - `API `_ +- `Example code `_ Code ---- diff --git a/examples/blink_onboard_led.py b/examples/blink_onboard_led.py deleted file mode 100644 index 0a0ef2f..0000000 --- a/examples/blink_onboard_led.py +++ /dev/null @@ -1,12 +0,0 @@ -# Blink the onboard LED, sleep for 10 seconds then stop the blinking - -from time import sleep -from pico import Button, LED - -led = LED() - -led.blink(0.5) -print("Blinking") -sleep(10) -led.blink_stop() -print("Stopped blinking") diff --git a/examples/color_dial.py b/examples/color_dial.py deleted file mode 100644 index 8a4f2c2..0000000 --- a/examples/color_dial.py +++ /dev/null @@ -1,29 +0,0 @@ -from picozero import RGBLED, Pot -from time import sleep - -rgb = RGBLED(red=2, green=1, blue=0) -dial = Pot(0) - -while True: - hue = 255 - (dial.value * 255) - - if hue < 85: - rgb.red = 255 - hue * 3 - rgb.green = 0 - rgb.blue = hue * 3 - - elif hue < 170: - hue -= 85; - rgb.red = 0 - rgb.green = hue * 3 - rgb.blue = 255 - hue * 3 - - else: - hue -= 170; - rgb.red = int(hue * 3) - rgb.green = int(255 - (hue * 3)) - rgb.blue = 0 - - #print(rgb.blue, hue, rgb.green, rgb.red) # order to match Thonny plotter colours - print(hue, rgb.red, rgb.blue, rgb.green) - sleep(0.1) diff --git a/examples/fade_onboard_led.py b/examples/fade_onboard_led.py deleted file mode 100644 index 26613af..0000000 --- a/examples/fade_onboard_led.py +++ /dev/null @@ -1,12 +0,0 @@ -from picozero import LED -from time import sleep - -led = LED(25) - -while True: - for b in range(0, 100, 1): - led.brightness = b/100 - sleep(0.02) - for b in range(100, 0, -1): - led.brightness = b/100 - sleep(0.02) diff --git a/examples/motor.py b/examples/motor.py deleted file mode 100644 index 2116b54..0000000 --- a/examples/motor.py +++ /dev/null @@ -1,14 +0,0 @@ -from picozero import Motor -from time import sleep - -m = Motor(12, 13) - -# turn the motor for 1 second -print("the motor is turning") -m.move() -sleep(1) -m.stop() - -# or alternatively turn it at half speed for 2 seconds -m.move(speed=0.5, t=2) -print("the motor will turn at half speed and stop after 2 seconds") \ No newline at end of file diff --git a/examples/ultrasonic_distance_sensor.py b/examples/ultrasonic_distance_sensor.py deleted file mode 100644 index 54c3e7c..0000000 --- a/examples/ultrasonic_distance_sensor.py +++ /dev/null @@ -1,8 +0,0 @@ -from picozero import DistanceSensor -from time import sleep - -ds = DistanceSensor(5, 4) - -while True: - print(ds.distance) - sleep(0.1) \ No newline at end of file