|
Post by snakn1 on Apr 26, 2019 20:00:18 GMT -8
Help please I need to know how to adjust the brightness and contrast of the display, it is too dim to see well. I think it needs to be changed in the SSD1306.py, but not sure where or how.
|
|
|
Post by SDL on Apr 28, 2019 17:43:39 GMT -8
Here are some functions from the SSD1306.py file that should get you going:
def set_contrast(self, contrast): """Sets the contrast of the display. Contrast should be a value between 0 and 255.""" if contrast < 0 or contrast > 255: raise ValueError('Contrast must be a value from 0 to 255 (inclusive).') self.command(SSD1306_SETCONTRAST) self.command(contrast)
def dim(self, dim): """Adjusts contrast to dim the display if dim is True, otherwise sets the contrast to normal brightness if dim is False. """ # Assume dim display. contrast = 0 # Adjust contrast based on VCC if not dimming. if not dim: if self._vccstate == SSD1306_EXTERNALVCC: contrast = 0x9F else: contrast = 0xCF BP
|
|