Simple answer: Add this in the while loop, after writing to the monitor:
sleep(1)
Additionally, you never update the curE and maxE variables. Try this code:
cap = peripheral.wrap("back")
mon = peripheral.wrap("top")
mon.clear()
mon.setCursorPos(1,1)
while true do
mon.write(cap.getEnergyStored("west").."/"..cap.getMaxEnergyStored("west"))
sleep(1)
end
Complicated answer: "Yielding" allows CC to run other computers as well as yours. If you run a program without yielding in some form (sleeping, pulling an event, etc) the program will crash because it can't run other computers if one is hogging the thread.
Edited by apemanzilla, 15 June 2015 - 02:16 AM.