Battery level
from spike.control import wait_for_seconds import hub t= 0.05 //tiempo frequency = 200 //frecuencia para el sonido duration_ms = 50 //duración del sonido waveform = hub.sound.SOUND_SIN //tipo de onda para el sonido for x in range ( 0 , 9 , 1 ) : //producir nueve beeps y colores en el botón. hub.led ( x+ 1 ) hub.sound.beep ( frequency*x, duration_ms, waveform ) wait_for_seconds ( t ) //esperar t segundos c = hub.battery.capacity_left () for y in range ( 0 ,c/ 20 , 1 ) : //dibujar los leds correspondientes con el nivel de batería hub.display.pixel ( y, 4 , 9 ) //esperar t segundos wait_for_seconds ( t ) print ( c ) _