commit 3138d7c1dcac6a9d0be92b807870a14575b25aa3 Author: nihonium Date: Mon Feb 21 09:29:51 2022 +0300 init diff --git a/2/2-1-running-light.py b/2/2-1-running-light.py new file mode 100644 index 0000000..8fd5411 --- /dev/null +++ b/2/2-1-running-light.py @@ -0,0 +1,28 @@ +#!/bin/python3 + +import RPi.GPIO as GPIO +import time + +GPIO.setwarnings(False) + +GPIO.setmode(GPIO.BCM) + +leds = [21, 20, 16, 12, 7, 8, 25, 24] + +GPIO.setup(leds, GPIO.OUT) + +GPIO.output(leds, 0) + +for j in range(3): + for i in range(len(leds)): + if i != 0: + GPIO.output(leds[i-1], 0) + GPIO.output(leds[i], 1) + else: + GPIO.output(leds[i], 1) + GPIO.output(leds[-1], 0) + time.sleep(0.2) + +GPIO.output(leds, 0) + +GPIO.cleanup()