MicroPython module for 4 digit 7 segment display with HT16K33 backpack frederic.boulanger@centralesupelec.fr 2015-05-14 led4x7.py by CentraleSupélec is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Installation ------------ Copy the "led4x7.py" file to the root directory of your pyboard. Usage ----- from led4x7 import LED4x7 # Create a driver for an LED display at address 0x70 on I2C bus 1 disp = LED4x7() # You may also choose the I2C bus to use, the address of the display, the initial brightness, # or provide your own initialized I2C bus using the general form of the constructor: # LED4x7(i2c_bus=1, addr=0x70, brightness=15, i2c=None) # Turn on the display disp.on() # Address individual digits and select which segments are on disp.display(0, 0b00111111) # display a 0 on the leftmost digit disp.display(3, 0b00111000) # display a capital L on the rightmost digit # Address individual digits for displaying digits # Negative values switch the decimal point on disp.displayDigit(1, 2) # display 2 on the second digit from the left # Address individual digits for displaying characters disp.displayAlpha(2, 'A') # display A on the second digit from the right disp.displayAlpha(3, 'D', True) # display D on the rightmost digit, with a decimal dot # Use the whole display to display a number (between 0 and 9999) disp.displayNumber(1234) # Use the whole display to display text disp.displayString('Cool') # It also works with string of more than 4 characters by scrolling the string toward the left disp.displayString('Cool StuFF') # You can change the scrolling delay, or provide your own timer for scrolling with: # displayString(string, delay=300, timer=None) # You can stop the scrolling of a long string with disp.stopDisplayString() # Clear the display disp.clear() # Switch on the "o'clock" dots in the middle of the display disp.setDots(True) # Set the brighness of the display (0 = dimmest, 15 = brightest) disp.set_brightness(8) # Set the blink mode disp.blink(LED4X7.blink2Hz) disp.blink(LED4X7.blink1Hz) disp.blink(LED4X7.blinkHalfHz) disp.blink(LED4X7.blinkOff) # Turn the display off disp.off() # Switch off the internal oscillator of the display disp.stop() # Switch on the internal oscillator of the display disp.start()