-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.py
More file actions
40 lines (30 loc) · 767 Bytes
/
Test.py
File metadata and controls
40 lines (30 loc) · 767 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
32
33
34
35
36
37
38
import pygame
import Module
import time
import sys
from pygame.locals import *
pygame.init()
DISPLAYSURF = pygame.display.set_mode((300,300))
pygame.display.set_caption('LoCoMo Debugger')
mod = Module.Module("192.168.10.12")
mod.send_SetBrake(False);
while True:
#get all the user events
for event in pygame.event.get():
#if the user wants to quit
if event.type == QUIT:
print("Stopping")
mod.send_Stop()
pygame.quit()
sys.exit()
elif event.type == KEYUP:
mod.send_Stop()
elif event.type == KEYDOWN:
if event.key == K_LEFT:
mod.send_PowTo(800,5)
elif event.key == K_RIGHT:
mod.send_PowTo(-800,5)
elif event.key == K_SPACE:
print("Checking position")
mod.send_PosRequest(True)
pygame.display.update()