function charge(time)
redstone.setOutput("bottom",true);
sleep(time);
redstone.setOutput("top",true);
sleep(1);
redstone.setOutput("top",false);
redstone.setOutput("bottom",false);
os.reboot();
end
while true do
os.pullEvent("redstone");
on=redstone.getInput("front");
itemchk=redstone.getInput("right");
lever=redstone.getInput("left");
if on==true and itemchk==true and lever==true then
charge(30);
end
if on==true and itemchk==true and lever==false then
charge(5);
end
if on==false then
break
end
end
