grove.display.sh1107g
¶
- This is the code for
Examples
import time
from grove.factory import Factory
oled = Factory.getDisplay("SH1107G")
rows, cols = oled.size()
print("OLED model: {}".format(oled.name))
print("OLED type : {} x {}".format(cols, rows))
oled.setCursor(0, 0)
oled.write("hello world!")
oled.setCursor(0, cols - 1)
oled.write('X')
oled.setCursor(rows - 1, 0)
for i in range(cols):
oled.write(chr(ord('A') + i))
time.sleep(3)
oled.clear()
Classes¶
SH1107G_SSD1327
: OLED Display 1.12”(v2) use chip SSD1327 or SH1107G.
-
class
grove.display.sh1107g.
SH1107G_SSD1327
(address=60)[source]¶ OLED Display 1.12”(v2) use chip SSD1327 or SH1107G.
Parameters: address (int) – I2C device address, default to 0x3E. Inheritance
-
draw
(data, bytes)[source]¶ Quickly transfer/draw bulk data (specified by data) to OLED, transfer size specified by bytes.
Parameters: - data (list of int) – the data to transfer/draw
- bytes (int) – data size
-
home
()[source]¶ Positions the cursor in the upper-left of the OLED. That is, use that location in outputting subsequent text to the display.
-
name
¶ Get device name
Returns: SH1107G/SSD1307 depends your device plugin. Return type: string
-
setCursor
(row, column)[source]¶ Position the OLED cursor; that is, set the location at which subsequent text written to the OLED will be displayed.
Parameters: - row (int) – the row at which to position cursor, with 0 being the first row
- column (int) – the column at which to position cursor, with 0 being the first column
Returns: None
-