In this example, we will be building a binary clock using the club PiGlow in which each hour, minute, and second is represented by the three arms of PiGlow. The numbers are displayed in the binary format. We will now look at the code and learn what each part does:
import piglow from time import sleep from datetime import datetime piglow.auto_update = True show12hr = 1 ledbrightness = 10 piglow.all(0) hourcount = 0 currenthour = 0
Like the previous example, we import PiGlow and the time libraries, but we also import an additional library,
datetime, which gives us the current time. Then, we set the auto-update parameter to true so that PiGlow updates as soon as we make a change to it rather than pushing all the changes at once. ...