1
0
forked from MDL29/JacoBot

Receive instructions from Redis

MDL29/JacoBot#19
This commit is contained in:
mdl29 2024-04-23 14:26:27 +02:00
parent 6c4c40ed75
commit dab02d2aeb
2 changed files with 27 additions and 19 deletions

View File

@ -1,7 +1,14 @@
from turtle import *
import turtle
from importlib import resources
import math
from time import sleep
import redis
"""host = "192.168.20.49"
channel = "LPH"
r = redis.Redis(host="localhost")
mobile = r.pubsub()
mobile.subscribe('jacobot-instructions')
poscubettox = 0
poscubettoy = 0
@ -17,9 +24,6 @@ angle = 0
theme = 0
p = r.pubsub()
p.psubscribe(channel)
"""
def main():
def dark_theme():
@ -136,17 +140,21 @@ def main():
cubetto_init()
while True:
message = []
if message == "FORDWARD":
cubetto_forward()
elif message == "LEFT":
cubetto_left()
elif message == "RIGHT":
cubetto_right()
elif message == "i":
cubetto_init()
elif message == "FUNCTION":
pass
for m_recu in mobile.listen():
if m_recu:
m_data = m_recu["data"]
if m_data == b"FORWARD":
cubetto_forward()
elif m_data == b"LEFT":
cubetto_left()
elif m_data == b"RIGHT":
cubetto_right()
elif m_data == b"INIT":
cubetto_init()
elif m_data == b"EXIT":
exit()
sleep(0.3)
main()

View File

@ -20,4 +20,4 @@ jacovirt-bot = "jacovirt.jacobot:main"
jacovirt-pad = "jacovirt.pad.jacopad:main"
[[tool.poetry.include]]
path = "jacovirt/jacovirt/Img/*"
path = "jacovirt/jacovirt/Img/*"