From 375df187cbe0ab9c0d9b1c5b162b36208c35d769 Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Tue, 17 Aug 2021 10:28:59 +0100 Subject: [PATCH] Chapter 2 --- ch-2/blink.py | 12 ++++++++++++ ch-2/helloworld.py | 1 + ch-2/light_led.py | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 ch-2/blink.py create mode 100644 ch-2/helloworld.py create mode 100644 ch-2/light_led.py diff --git a/ch-2/blink.py b/ch-2/blink.py new file mode 100644 index 0000000..6b6c2b7 --- /dev/null +++ b/ch-2/blink.py @@ -0,0 +1,12 @@ +import time +import board +import digitalio + +led = digitalio.DigitalInOut(board.LED) +led.direction = digitalio.Direction.OUTPUT + +while True: + led.value = True + time.sleep(0.5) + led.value = False + time.sleep(0.5) diff --git a/ch-2/helloworld.py b/ch-2/helloworld.py new file mode 100644 index 0000000..1385fe3 --- /dev/null +++ b/ch-2/helloworld.py @@ -0,0 +1 @@ +print("Hello, world!") \ No newline at end of file diff --git a/ch-2/light_led.py b/ch-2/light_led.py new file mode 100644 index 0000000..5914659 --- /dev/null +++ b/ch-2/light_led.py @@ -0,0 +1,5 @@ +import board +import digitalio +led = digitalio.DigitalInOut(board.LED) +led.direction = digitalio.Direction.OUTPUT +led.value = True