|
3 | 3 | #
|
4 | 4 | # Copyright (c) 2025 SparkFun Electronics
|
5 | 5 | #-------------------------------------------------------------------------------
|
6 |
| -# ex01_touch_drive.py |
| 6 | +# ex01_touch_screen_drive.py |
7 | 7 | #
|
8 | 8 | # This example creates a simple touch screen interface to drive the XRP robot.
|
9 | 9 | # It creates arrow buttons to drive around, and a stop button to exit the
|
@@ -138,25 +138,25 @@ def create_ui_image():
|
138 | 138 | elif (ui_cx - button_cx <= x <= ui_cx + button_cx and
|
139 | 139 | ui_cy - button_spacing - button_cy <= y <= ui_cy - button_spacing + button_cy):
|
140 | 140 | print("Forward")
|
141 |
| - # drivetrain.straight(20, 0.5) |
| 141 | + drivetrain.straight(20, 0.5) |
142 | 142 |
|
143 | 143 | # Check if the backward arrow was pressed
|
144 | 144 | elif (ui_cx - button_cx <= x <= ui_cx + button_cx and
|
145 | 145 | ui_cy + button_spacing - button_cy <= y <= ui_cy + button_spacing + button_cy):
|
146 | 146 | print("Backward")
|
147 |
| - # drivetrain.straight(-20, 0.5) |
| 147 | + drivetrain.straight(-20, 0.5) |
148 | 148 |
|
149 | 149 | # Check if the right arrow was pressed
|
150 | 150 | elif (ui_cy - button_cy <= y <= ui_cy + button_cy and
|
151 | 151 | ui_cx + button_spacing - button_cx <= x <= ui_cx + button_spacing + button_cx):
|
152 | 152 | print("Right")
|
153 |
| - # drivetrain.turn(-90, 0.5) |
| 153 | + drivetrain.turn(-90, 0.5) |
154 | 154 |
|
155 | 155 | # Check if the left arrow was pressed
|
156 | 156 | elif (ui_cy - button_cy <= y <= ui_cy + button_cy and
|
157 | 157 | ui_cx - button_spacing - button_cx <= x <= ui_cx - button_spacing + button_cx):
|
158 | 158 | print("Left")
|
159 |
| - # drivetrain.turn(90, 0.5) |
| 159 | + drivetrain.turn(90, 0.5) |
160 | 160 |
|
161 | 161 | # Check for key presses
|
162 | 162 | key = cv.waitKey(1)
|
|
0 commit comments