parent
4f439dc340
commit
93be9c7910
11
main.py
11
main.py
|
@ -2,7 +2,6 @@ import time
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
try:
|
try:
|
||||||
import requests
|
|
||||||
from rpi_ws281x import *
|
from rpi_ws281x import *
|
||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import socket
|
import socket
|
||||||
|
@ -33,13 +32,6 @@ def debug_print(message: str):
|
||||||
current_time = now.strftime("%H:%M:%S")
|
current_time = now.strftime("%H:%M:%S")
|
||||||
print('[DEBUG]['+current_time+'] '+message)
|
print('[DEBUG]['+current_time+'] '+message)
|
||||||
|
|
||||||
def check_internet(url='http://www.google.com/', timeout=1):
|
|
||||||
try:
|
|
||||||
_ = requests.head(url, timeout=timeout)
|
|
||||||
return True
|
|
||||||
except requests.ConnectionError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def wheel(pos):
|
def wheel(pos):
|
||||||
if pos < 85:
|
if pos < 85:
|
||||||
return Color(pos * 3, 255 - pos * 3, 0)
|
return Color(pos * 3, 255 - pos * 3, 0)
|
||||||
|
@ -112,9 +104,6 @@ if __name__ == '__main__':
|
||||||
# print(socket_data)
|
# print(socket_data)
|
||||||
# print(type(socket_data))
|
# print(type(socket_data))
|
||||||
if led_power == True:
|
if led_power == True:
|
||||||
if check_internet() == False:
|
|
||||||
blink(strip, Color(255,0,0), Color(255,255,255))
|
|
||||||
else:
|
|
||||||
if idle_mode == 1:
|
if idle_mode == 1:
|
||||||
rainbowCycle(strip)
|
rainbowCycle(strip)
|
||||||
elif idle_mode == 2:
|
elif idle_mode == 2:
|
||||||
|
|
Loading…
Reference in New Issue