-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.py
63 lines (49 loc) · 1.22 KB
/
program.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ENABLE_GPIO = False
import math
import time
import os
from rich.console import Console
if (ENABLE_GPIO):
import RPi.GPIO as GPIO
console = Console()
def print_set1_on():
os.system('clear')
console.print("\r* * * * * * * * * * * * * * * * * *", style='bold blue')
def print_set2_on():
os.system('clear')
console.print("\r * * * * * * * * * * * * * * * * *", style='bold blue')
def set1_on():
print_set1_on()
if (ENABLE_GPIO):
GPIO.output(7, GPIO.HIGH)
GPIO.output(5, GPIO.LOW)
def set2_on():
print_set2_on()
if (ENABLE_GPIO):
GPIO.output(7, GPIO.LOW)
GPIO.output(5, GPIO.HIGH)
def get_delay(x):
if x < 50:
delay = 0.1
elif x > 90:
delay = 0.5
else:
delay = 0.2
return delay
if (ENABLE_GPIO):
# GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)
x = 0
while True:
x = x + 1
delay = get_delay(x)
set1_on()
time.sleep(delay)
set2_on()
time.sleep(delay)
if x > 100:
x = 0
if (ENABLE_GPIO):
GPIO.cleanup()