Skip to content

Commit

Permalink
feat: add networktables keyboard test
Browse files Browse the repository at this point in the history
  • Loading branch information
megarubber committed Oct 8, 2023
1 parent 910217b commit 1e3ab78
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions networktables/using_keyboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import time
import ntcore # pip install robotpy
import keyboard # pip install keyboard

inst = ntcore.NetworkTableInstance.getDefault()
table = inst.getTable("keyboard")
inst.startClient4("keyboard")

# pick one of these
# inst.setServer("10.te.am.2")
# inst.setServerTeam(4096)
# inst.startDSClient()

while not inst.isConnected():
print("not connected")
time.sleep(1)

while True:
event = keyboard.read_event()
if event.name:
table.putBoolean(event.name, event.event_type == keyboard.KEY_DOWN)

0 comments on commit 1e3ab78

Please sign in to comment.