Closed rabagliati closed 3 years ago
I have written some python code, which writes to the 7 segment displays.
I adapted the code from the Happy Birthday example.
It works - but only after I have run the demo - otherwise the LEDs remain off.
To repeat, if I run my code right after boot, the LEDs are blank.
If I run the Happy Birthday demo, the next time I run my code the LEDs display my numbers.
Here is my code - simplified
#! /usr/bin/python2 import datetime from Adafruit_LED_Backpack import SevenSegment segment = SevenSegment.SevenSegment(address=0x70) now = datetime.datetime.now() hour = now.hour minute = now.minute second = now.second segment.clear() segment.set_digit(0, int(hour / 10)) segment.set_digit(1, hour % 10) segment.set_digit(2, int(minute / 10)) segment.set_digit(3, minute % 10) segment.set_colon(2) segment.write_display()
I needed this :-
segment.begin()
Closing.
I have written some python code, which writes to the 7 segment displays.
I adapted the code from the Happy Birthday example.
It works - but only after I have run the demo - otherwise the LEDs remain off.
To repeat, if I run my code right after boot, the LEDs are blank.
If I run the Happy Birthday demo, the next time I run my code the LEDs display my numbers.
Here is my code - simplified