blinkt implementation - pings chuckdries.com
This commit is contained in:
commit
1540e487b3
138
.gitignore
vendored
Normal file
138
.gitignore
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
38
main.py
Executable file
38
main.py
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from gpiozero import LED
|
||||
from time import sleep
|
||||
import requests
|
||||
import blinkt
|
||||
|
||||
|
||||
blinkt.set_clear_on_exit()
|
||||
|
||||
|
||||
# led = LED(17)
|
||||
|
||||
while True:
|
||||
print("hello")
|
||||
try:
|
||||
r = requests.get("https://chuckdries.com")
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
blinkt.set_all(255, 0, 0)
|
||||
# led.on()
|
||||
print(e)
|
||||
except requests.exceptions.Timeout as e:
|
||||
# led.off()
|
||||
blinkt.set_all(255, 0, 0)
|
||||
print(e)
|
||||
else:
|
||||
# led.off()
|
||||
blinkt.set_all(0, 255, 0)
|
||||
print("request succeeded")
|
||||
blinkt.show()
|
||||
sleep(2)
|
||||
blinkt.clear()
|
||||
blinkt.show()
|
||||
sleep(10)
|
||||
# led.on()
|
||||
# sleep(1)
|
||||
# led.off()
|
||||
# sleep(1)
|
81
requirements.txt
Normal file
81
requirements.txt
Normal file
@ -0,0 +1,81 @@
|
||||
astroid==2.4.2
|
||||
automationhat==0.0.4
|
||||
autopep8==1.5.5
|
||||
blinker==1.3
|
||||
blinkt==0.1.2
|
||||
buttonshim==0.0.2
|
||||
Cap1xxx==0.1.3
|
||||
certifi==2020.12.5
|
||||
chardet==4.0.0
|
||||
click==6.6
|
||||
colorama==0.3.7
|
||||
cryptography==1.7.1
|
||||
drumhat==0.1.0
|
||||
envirophat==0.0.6
|
||||
ExplorerHAT==0.4.2
|
||||
Flask==0.12.1
|
||||
fourletterphat==0.1.0
|
||||
gpiozero==1.4.1
|
||||
idna==2.10
|
||||
isort==4.3.21
|
||||
itsdangerous==0.24
|
||||
jedi==0.10.2
|
||||
Jinja2==2.8
|
||||
keyring==10.1
|
||||
keyrings.alt==1.3
|
||||
lazy-object-proxy==1.4.3
|
||||
MarkupSafe==0.23
|
||||
mccabe==0.6.1
|
||||
mcpi==0.1.1
|
||||
microdotphat==0.1.3
|
||||
mote==0.0.3
|
||||
motephat==0.0.2
|
||||
numpy==1.12.1
|
||||
oauthlib==2.0.1
|
||||
pantilthat==0.0.5
|
||||
pgzero==1.2
|
||||
phatbeat==0.1.0
|
||||
pianohat==0.1.0
|
||||
picamera==1.13
|
||||
picraft==1.0
|
||||
piglow==1.2.4
|
||||
pigpio==1.38
|
||||
Pillow==4.0.0
|
||||
psutil==5.0.1
|
||||
pyasn1==0.1.9
|
||||
pycodestyle==2.6.0
|
||||
pycrypto==2.6.1
|
||||
pygame==1.9.3
|
||||
pygobject==3.22.0
|
||||
pyinotify==0.9.6
|
||||
PyJWT==1.4.2
|
||||
pylint==2.6.2
|
||||
pyOpenSSL==16.2.0
|
||||
pyserial==3.2.1
|
||||
python-apt==1.1.0b5
|
||||
pyxdg==0.25
|
||||
rainbowhat==0.0.2
|
||||
requests==2.25.1
|
||||
requests-oauthlib==0.7.0
|
||||
RPi.GPIO==0.6.5
|
||||
RTIMULib==7.2.1
|
||||
scrollphat==0.0.7
|
||||
scrollphathd==1.2.0
|
||||
SecretStorage==2.3.1
|
||||
sense-emu==1.0
|
||||
sense-hat==2.2.0
|
||||
simplejson==3.10.0
|
||||
six==1.15.0
|
||||
skywriter==0.0.7
|
||||
sn3218==1.2.7
|
||||
spidev==3.3
|
||||
thonny==2.1.16
|
||||
toml==0.10.2
|
||||
touchphat==0.0.1
|
||||
tweepy==3.5.0
|
||||
twython==3.4.0
|
||||
typed-ast==1.4.2
|
||||
unicornhathd==0.0.3
|
||||
urllib3==1.26.4
|
||||
Werkzeug==0.11.15
|
||||
wrapt==1.12.1
|
Loading…
x
Reference in New Issue
Block a user