I believe it's because you're only grabbing the energy stored once during the entire code and so it's only got one number it knows. try adding
energy = cube.getEnergyStored('right')
inside the while loop. Also it is good practice to make every variable local so that other programs and such cannot use them, you just need to add the word local in front of the one you make first, the rest don't need it because they will see the first think, oooh it's already a local variable, lets stay as one. So you should add it infront of energy, cube, and monitor. Only the ones at the top under vars, all the others are fine and don't matter.
Edited by Dragon53535, 16 August 2014 - 02:48 PM.