Wij blijven tot middernacht bestellingen verzenden, het invoeren van de avondklok in Nederland heeft geen impact op onze dienstverlening.

So now the last thing to do is to put everything together in an everlasting loop (exception the keyboard interupt "ctr + c" will stop the code and clean everything up "GPIO.cleanup()").

 

So first we have to get the time with our GetTimeToDigit function and safely store the returned variables.

Then we can Show the first digit of the hour with the DisplayDigit function and just repeat this with the other digits with the required amount of delay between the two.

 

What is going to be handy is to put the everlasting loop in a try so when you press "ctl + c" it will stop the program in a clean way.

So the main loop is going to look like this

Don't forget to put the library code in a clock.py file that is in the same folder as the main file. Becaus otherwise it won't work

Reacties