#Proyecto: Planilla de luz
#Nombre: Zhayanka Pilay
#Fecha 04/07/25
import time
from machine import Pin
# LEDs
led_verde = Pin(0, Pin.OUT) # LED verde en GP0
led_amarillo = Pin(4, Pin.OUT) # LED amarillo en GP4
led_rojo = Pin(9, Pin.OUT) # LED rojo en GP9
# VariableS
eneF=0
tarifa=0
IVA=0
total=0
AP=0
com=0
time.sleep(0.1) # Wait for USB to become ready
#Información del Consumidor
ctaco=200049671429
cu=0900288359
ce= 0953903465
#Energías
eneT=193.00 #Energía Total
eneC=27.00 #Energía Cocción
eneF=eneT-eneC
# Cálculos
com=1.41
tarifa= 0.0934
AP=1.83
vcon = eneF * tarifa
IVA=0.00
cb=2.35
rb=1.78
totalre=cb+rb
total=vcon+IVA+com
vt=AP+totalre
#Planilla de Luz
print(" ********************")
print(" CNEL\n")
print(" ********************")
print(" Matriz: Km 6 1/2 Vía a la Costa\n")
print(" RUC:0968599020001 Fecha de emisión: 26-06-2025\n")
print(" Contribuyente especial, resolución No.065 Fecha de vencimiento: 25-07-2025 \n")
print(" Información del Consumidor VALOR TOTAL", vt)
print(" _______________________________________________________________________\n")
print(" CUENTA CONTRATO"," ",ctaco, " Código Único"," ",cu)
print(" Nombre Cliente"," "," PILAY BELTRÁN ZHAYANKA NATHALY " )
print(" Cédula"," ",ce, " Unidad de Lectura"," 0919M012\n")
print(" Dirección del servicio"," Rcto. El Laurel")
#Información
print(" 1. Información Servicio Eléctrico y Alumbrado Público")
print(" _______________________________________________________________________\n")
print(" Número de medidor", " 1503778071 ")
print(" Tipo consumo leído"," Días facturados 30")
print(" Fecha desde 26-06-2025"," Fecha hasta 25-07-2025")
print("\n")
print(" Descripción Consumo Total U. Medida Monto($)",)
print(" Energía activa total"," ",eneT," ", "KWH"" ", "0.00")
print(" Energía Cocción Eléctrica")
print(" y Calentamiento de Agua"," ",eneC," ","KWH"" ", "0.00")
print(f" Energía Facturada"," ",eneF," ","KWH"" ",round(vcon,2))
print("\n")
#Factura
print(f" Valor Consumo: ${round(vcon, 2)}")
print(f" Comercialización: ${round(com, 2)}")
print(f" Compensación D.E.561 ${round(total,2)}")
print(f" Servicio Alumbrado Público: ${round(AP, 2)}")
print(f" IVA 0%: ${round(IVA, 2)}")
print(f" Total a pagar: ${round(total, 2)}")
print("\n")
print(" -------------------------------------------")
print(" Recaudación Terceros\n")
print(" NOTIFICACIÓN DE PAGO DEL TRIBUTO PARA")
print(" EL CUERPO DE BOMBEROS")
print(" C. BOMBEROS")
print(" CONCEPTO VALOR")
print(" Contribución Bomberos", " " ,cb)
print(" TOTAL CONTRIBUCIÓN BOMBEROS", " ", cb)
print("\n")
print(" -------------------------------------------")
print(" NOTIFICACIÓN DE PAGO DEL TRIBUTO PARA")
print(" LA TASA DE RECOLECCIÓN DE BASURA")
print(" CONCEPTO VALOR")
print(" Tasa de recolección de basura", " " ,rb)
print(" TOTAL RECOLECCIÓN DE BASURA", " ", rb)
print("\n")
print(" -------------------------------------------")
print(" RESUMEN DE VALORES")
print(" Total Sector Eléctrico"," " ,AP)
print(" Total Recaudación de Terceros"," " ,totalre)
print(" VALOR TOTAL(USD)"," " ,vt)
print("\n")
# Condición de alerta con LEDs
if eneF <= 110:
led_verde.on()
led_amarillo.off()
led_rojo.off()
print("🟢 Consumo bajo")
elif eneF <= 200:
led_verde.off()
led_amarillo.on()
led_rojo.off()
print("🟡 Consumo medio")
else:
led_verde.off()
led_amarillo.off()
led_rojo.on()
print("🔴 Consumo alto")