Skip to content

Commit 81f3be7

Browse files
committed
Fix XRP touch screen drive example
Uncomment drive functions Also rename to "touch_screen_drive"
1 parent 8637030 commit 81f3be7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

opencv-examples/xrp_examples/ex01_touch_drive.py renamed to opencv-examples/xrp_examples/ex01_touch_screen_drive.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Copyright (c) 2025 SparkFun Electronics
55
#-------------------------------------------------------------------------------
6-
# ex01_touch_drive.py
6+
# ex01_touch_screen_drive.py
77
#
88
# This example creates a simple touch screen interface to drive the XRP robot.
99
# It creates arrow buttons to drive around, and a stop button to exit the
@@ -138,25 +138,25 @@ def create_ui_image():
138138
elif (ui_cx - button_cx <= x <= ui_cx + button_cx and
139139
ui_cy - button_spacing - button_cy <= y <= ui_cy - button_spacing + button_cy):
140140
print("Forward")
141-
# drivetrain.straight(20, 0.5)
141+
drivetrain.straight(20, 0.5)
142142

143143
# Check if the backward arrow was pressed
144144
elif (ui_cx - button_cx <= x <= ui_cx + button_cx and
145145
ui_cy + button_spacing - button_cy <= y <= ui_cy + button_spacing + button_cy):
146146
print("Backward")
147-
# drivetrain.straight(-20, 0.5)
147+
drivetrain.straight(-20, 0.5)
148148

149149
# Check if the right arrow was pressed
150150
elif (ui_cy - button_cy <= y <= ui_cy + button_cy and
151151
ui_cx + button_spacing - button_cx <= x <= ui_cx + button_spacing + button_cx):
152152
print("Right")
153-
# drivetrain.turn(-90, 0.5)
153+
drivetrain.turn(-90, 0.5)
154154

155155
# Check if the left arrow was pressed
156156
elif (ui_cy - button_cy <= y <= ui_cy + button_cy and
157157
ui_cx - button_spacing - button_cx <= x <= ui_cx - button_spacing + button_cx):
158158
print("Left")
159-
# drivetrain.turn(90, 0.5)
159+
drivetrain.turn(90, 0.5)
160160

161161
# Check for key presses
162162
key = cv.waitKey(1)

0 commit comments

Comments
 (0)