Python clock
Posted: Thu Sep 20, 2018 7:17 pm
Hi all, I am trying to write program for driving WS2812 led strip as digital clock (7 diodes per digit). I am able to turn each led separately on and I am able to "print" digits on my testing digit.
But I am printing digits like idiot (simple counting example):
and so on...
Can someone please help me to understand and create logic of this simple program? I wanna reach to "print" hours & minutes in 24h format on my strip. My idea is declare own function for diplaying numbers and add some logic before, but I am noob Python programes.
But I am printing digits like idiot (simple counting example):
Code: Select all
while True:
strip.setPixelColor(0, Color(0,0,0))
strip.setPixelColor(1, Color(255,255,255))
strip.setPixelColor(2, Color(255,255,0))
strip.setPixelColor(3, Color(255,255,255))
strip.setPixelColor(4, Color(255,255,0))
strip.setPixelColor(5, Color(255,255,255))
strip.setPixelColor(6, Color(255,255,0))
strip.show()
time.sleep(1)
strip.setPixelColor(0, Color(0,0,0))
strip.setPixelColor(1, Color(255,255,255))
strip.setPixelColor(2, Color(0,0,0))
strip.setPixelColor(3, Color(0,0,0))
strip.setPixelColor(4, Color(0,0,0))
strip.setPixelColor(5, Color(0,0,0))
strip.setPixelColor(6, Color(255,255,0))
strip.show()
time.sleep(1)Can someone please help me to understand and create logic of this simple program? I wanna reach to "print" hours & minutes in 24h format on my strip. My idea is declare own function for diplaying numbers and add some logic before, but I am noob Python programes.