-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_bt.py
More file actions
31 lines (23 loc) · 832 Bytes
/
Copy pathtest_bt.py
File metadata and controls
31 lines (23 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import subprocess
import sys
from datetime import datetime
LISTEN_PORT = 8080
DEBUG = True
def log(msg, color=""):
timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
print(f"{color}[{timestamp}] {msg}\033[0m" if color else f"[{timestamp}] {msg}")
print("🚀 NXT Bridge via macOS IOBluetooth")
# Use macOS blueutil to connect
try:
# Check if blueutil is installed
result = subprocess.run(["which", "blueutil"], capture_output=True)
if result.returncode != 0:
print("❌ blueutil not found!")
print(" Install with: brew install blueutil")
sys.exit(1)
# Find NXT
result = subprocess.run(["blueutil", "--paired"], capture_output=True, text=True)
print(f"\n📱 Paired devices:\n{result.stdout}")
except Exception as e:
print(f"❌ Error: {e}")
sys.exit(1)