Hi there, I need a little bit of help in programming a Micro Dot pHAT. I want it to show me the number of days between a particularly date and the current day, and of course, to be able to update by itself, working like a sort of a clock, counting days.
My knowledge in Python is for from being enough to achieve that, even this is probably a beginner level. So, this is my progress till now:
This part of the script will calculate the number of days I need to find and it’s working:
import datetime
today = datetime.date.today()
someday = datetime.date(1978, 10, 29)
diff = today - someday
diff.days
Of course, “diff.days” will bing me the result I need, but I don’t know how to push this to be shown on my Micro Dot pHAT display. Probably it must be something like this “write_string(diff.days, kerning=False)”, but It isn’t working.
I imagine a full script must look like this:
import datetime
from microdotphat import write_string, set_decimal, clear, show
today = datetime.date.today()
someday = datetime.date(1978, 10, 29)
diff = today - someday
diff.days
write_string(diff.days, kerning=False)
show()
Of course I still need to find a way to update it by itself.
Any ideea will be helpful.
Thank you,
Alex