Python

show the time with green and blue leds :-)

1 637
I have my Banana Pro (running Bananian) near my bed, and during the nights its leds are a bit too much bright :-).

Until now, I was covering the device with a cardboard box at nightime. Researching about how to disable the leds, I came with another idea: what if instead of being a source of distraction I could use the leds to know the time? Would be useful when awakeing in the middle of the night, to avoid checking the time with my phone and its very bright screen.

Well, after several tests I got an useful python script. You can check it here http://pastebin.com/U5b0UqiA

Basically, it shows the hour part blinking the blue led as many times as the hour is. For the minute I use the green led, and split the number of minutes in two parts: first digit and second digit. Special cases are when there is a 0 somewhere. For that I use a mixture of blue and green leds. A bit confussing, check the source :-)

I am sure it could be improved in several ways (morse code maybe?), but until now for me is already useful. And was an interesting mini project to begin to play with my shiny new Banana Pro.








Cool idea! Thx!

You have to log in before you can reply Login | Sign Up

Points Rules