10.3.2 Adjust display contrast

Use the RPiSparkModeule.RPiSpark.Screen.Display instance object to adjust the display contrast (see the SSD1306_128x64 manual) for contrast values ranging from 0 to 255.

def _adjustContrast(self, offset):
    self.dsp_contrast += offset
    if self.dsp_contrast > 255: self.dsp_contrast = 255
    if self.dsp_contrast < 20: self.dsp_contrast = 20
    self.RPiSpark.Screen.Display.setContrast(self.dsp_contrast)

 

Was this article helpful?

YES     |     NO

 

Enjoying the project? Spotted a mistake? Any opinions on the website? Let us know!