A couple things,
repeat
local_, k == os.pullevent()
until k == keys.backspace()
The parentheses on keys.backspace shouldn't be there, and "event" in "os.pullevent" should be capitalized.
Also, the whole timer bit at the bottom, that's actually the waiting period in between redstone signal settings. So, while removing it from the bottom, you would replace it at the top in your runEngines() function.
Here's what the entire code would be.
function countdown(text, time)
for i = time, 0, -1 do
term.clear()
term.setCursorPos(1,1)
local minutes = math.floor(i/60)
local seconds = i%60
if #tostring(seconds) == 1 then
seconds = 0 .. seconds
end
local timeStr = minutes..":"..seconds
print(text..' : '..timeStr)
sleep(1)
end
end
function runEngines()
redstone.setOutput("left", true)
countdown('Running engines', 600)
redstone.setOutput("left", false)
countdown('Cooling down', 350)
end
function stop()
repeat
local_, k == os.pullEvent()
until k == keys.backspace
redstone.setOutput("left", false)
end
print "Start engines?"
local input = read()
if input == "yes" then
parallel.waitForAny(runEngines, stop)
end
To simplify things a bit, I've added a countdown() function at the top, which basically displays the minute and seconds text, and a text before that. So while the engines are running, it'll display "Running engines : [time]" and while cooling, "Cooling down : [time]".