Skip to content

Commit

Permalink
make cam stuff optional offcourse :)
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Aug 2, 2020
1 parent 351786e commit 39a7d8e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions micropython/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ id="test"
import display_web
display_class=display_web.Display
run_webserver=True

status_ip=''


29 changes: 15 additions & 14 deletions micropython/meowton.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,21 @@ def p():
global last_state
last_state="bla"
def cam_send(state):
global last_state
if state!=last_state:
try:
# print("Setting cam to "+state)
s=usocket.socket()
sockaddr = usocket.getaddrinfo('192.168.13.233', 1234)[0][-1]
s.connect(sockaddr)
s.send(state+"\n")
s.close()
# print("Cam send done")
except Exception as e:
# print("failed: "+str(e))
pass
last_state=state
"""this will control an external device to control a camera or light"""
if config.status_ip:
global last_state
if state!=last_state:
try:
# print("Setting cam to "+state)
s=usocket.socket()config.status_ip, 1234)[0][-1]
s.connect(sockaddr)
s.send(state+"\n")
s.close()
# print("Cam send done")
except Exception as e:
# print("failed: "+str(e))
pass
last_state=state


################ read sensors, fast stuff
Expand Down

0 comments on commit 39a7d8e

Please sign in to comment.