Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Declaration des peripheriques
- matrice = peripheral.wrap("bottom")
- screen = peripheral.wrap("back")
- --Debut du programme (boucle infinie)
- while true do
- --Recuperation des quantites d'energie stockes
- stock = matrice.getEnergyStored()
- os.sleep(0.2)
- stock2 = matrice.getEnergyStored()
- --Clear de l'ecran
- screen.clear()
- --Titre
- screen.setTextScale(2)
- screen.setTextColor(colors.blue)
- screen.setCursorPos(9,1)
- screen.write("Rendement energetique")
- --Affichage de la quantite d'enerie stocke
- screen.setCursorPos(3,3)
- screen.setTextColor(colors.black)
- screen.write("Stock actuel :")
- screen.setCursorPos(18,3)
- screen.setTextColor(colors.white)
- screen.write(stock/2500000000)
- screen.setCursorPos(24,3)
- screen.write(" ")
- screen.setCursorPos(25,3)
- screen.setTextColor(colors.black)
- screen.write("GRF")
- --Bug de la quantite trop longue a l'affichage
- screen.setCursorPos(28,3)
- screen.write(" ")
- --Recuperation de la capacite de stockage
- max = matrice.getMaxEnergyStored()
- --Calcul du pourcentage de stockage utilise
- pourcent = (stock/max)*100
- --Affichage du pourcentage de stockage utilise
- screen.setCursorPos(30,3)
- screen.setTextColor(colors.white)
- screen.write(pourcent)
- screen.setCursorPos(34,3)
- screen.setTextColor(colors.black)
- screen.write("%")
- --Bug de la quantite trop longue a l'affichage
- screen.setCursorPos(35,3)
- screen.write(" ")
- consommation = stock - stock2
- screen.setCursorPos(3,4)
- screen.setTextColor(colors.black)
- screen.write("Consommation :")
- screen.setCursorPos(18,4)
- screen.setTextColor(colors.white)
- screen.write(math.ceil(consommation/10))
- screen.setCursorPos(23,4)
- screen.write(" ")
- screen.setCursorPos(25,4)
- screen.setTextColor(colors.black)
- screen.write("RF/T")
- if consommation => 0
- then screen.setBackgroundColor(colors.red)
- elseif screen.setBackgroundColor(colors.green)
- end
Advertisement
Add Comment
Please, Sign In to add comment