← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/control.py
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-04-25 09:34:22 +0200
committerEdvin <[email protected]>2025-04-25 09:34:22 +0200
commit13f214535536ec59a9e1442ed325a537238cb7c1 (patch)
tree650c3de22d977c9442dcb1209cb3305291485ef1 /control.py
parent973d2c26abde257c842548c4af0ff4c3a3a8162c (diff)
Removed control.py
Diffstat (limited to 'control.py')
-rwxr-xr-xcontrol.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/control.py b/control.py
deleted file mode 100755
index f86d3bf..0000000
--- a/control.py
+++ /dev/null
@@ -1,61 +0,0 @@
-import bluetooth
-import time
-
-import termios
-import tty
-import sys
-
-def get_input() -> str:
-
- filedescriptors = termios.tcgetattr(sys.stdin)
- tty.setcbreak(sys.stdin)
- key = sys.stdin.read(1)[0]
- termios.tcsetattr(sys.stdin, termios.TCSADRAIN,filedescriptors)
-
- return key
-
-pi = "B8:27:EB:D1:A5:A9"
-
-sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
-
-print("Attempting to connect to %s..." % pi)
-
-sock.connect((pi, 1))
-
-print("Connected to %s." % pi)
-
-input = "0"
-
-while input != "q":
- input = get_input()
-
- print("Sending: %s" % input)
- if input == "i":
- sock.send("11")
- elif input == "j":
- sock.send("44")
- elif input == "l":
- sock.send("33")
- elif input == "k":
- sock.send("22")
- elif input == "q":
- sock.send("1000")
- else:
- sock.send("0")
-
- read = sock.recv(1024)
- read = read.decode("utf-8").strip('\n')
- print("Received: '%s'" % read )
-
- time.sleep(0.1)
-
-print("Sending: %s" % input)
-sock.send(input)
-
-read = sock.recv(1024)
-read = read.decode("utf-8").strip('\n')
-print("Received: '%s'" % read )
-
-print("Shutting down...")
-
-sock.close()