You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
458 B
21 lines
458 B
local robot = require("robot")
|
|
local event = require("event")
|
|
|
|
print("Control using w,s,q,e. Exit using c")
|
|
|
|
while true do
|
|
local _, _, ascii, _, _ = event.pull("key_down")
|
|
local ch = string.char(ascii)
|
|
if ch == 'q' then
|
|
robot.turnLeft()
|
|
elseif ch == 'e' then
|
|
robot.turnRight()
|
|
elseif ch == 'w' then
|
|
robot.forward()
|
|
elseif ch == 's' then
|
|
robot.back()
|
|
elseif ch == 'c' then
|
|
break
|
|
end
|
|
end
|