My program for robot(flashed in eeprom) dont work and causes error i typed in topic title.
Here is the code:
robot = component.proxy(component.list("robot")())
rs = component.proxy(component.list("redstone")())
function getBatteryPercent ()
local percent = computer.energy() * 100 / computer.maxEnergy()
return percent
end
function wait(seconds)
local begin = os.time()
repeat
computer.pullSignal(0.05)
until os.time() - begin >= seconds
end
while true do
robot.turn(true)
robot.turn(true)
robot.move(1)
while robot.compare() ~= true do
robot.move(3)
if robot.detect(5) == true then
robot.turn(false)
robot.swing()
robot.turn(true)
end
if robot.detect(4) == true then
robot.turn(true)
robot.swing()
robot.turn(false)
end
end
robot.turn(true)
robot.move(0)
robot.turn(true)
while true do
if redstone.getInput(1) > 0 then
if getBatteryPercent() < 20.0 then
rs.setOutput(0, 15)
else
rs.setOutput(0, 0)
end
wait(60)
else
robot.move(3)
end end end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hi!(again)
My program for robot(flashed in eeprom) dont work and causes error i typed in topic title.
Here is the code:
Link to post
Share on other sites