當前位置: 首頁>>代碼示例>>Python>>正文


Python Adafruit_SSD1306.SSD1306_128_64屬性代碼示例

本文整理匯總了Python中Adafruit_SSD1306.SSD1306_128_64屬性的典型用法代碼示例。如果您正苦於以下問題:Python Adafruit_SSD1306.SSD1306_128_64屬性的具體用法?Python Adafruit_SSD1306.SSD1306_128_64怎麽用?Python Adafruit_SSD1306.SSD1306_128_64使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在Adafruit_SSD1306的用法示例。


在下文中一共展示了Adafruit_SSD1306.SSD1306_128_64屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import Adafruit_SSD1306 [as 別名]
# 或者: from Adafruit_SSD1306 import SSD1306_128_64 [as 別名]
def __init__(self):
                self.ser = serial.Serial(port='/dev/ttyAMA0',baudrate=9600, timeout = 0.2)
                # Raspberry Pi pin configuration:
                RST = 24
                # Note the following are only used with SPI:
                DC = 23
                SPI_PORT = 0
                SPI_DEVICE = 0
                # 128x32 display with hardware I2C:
                #self.disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
                # 128x64 display with hardware I2C:
                self.disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
                # Initialize library.
                self.disp.begin()

                # Clear display.
                self.disp.clear()
                self.disp.display()

                # Create blank image for drawing.
                # Make sure to create image with mode '1' for 1-bit color.
                width = self.disp.width
                height = self.disp.height
                self.image = Image.new('1', (width, height))

                # Get drawing object to draw on image.
                self.draw = ImageDraw.Draw(self.image)
                padding = 2
                shape_width = 20
                top = padding
                bottom = height-padding
                x = padding
                x += shape_width+padding

                # Load default font.
                #self.font = ImageFont.load_default()
                self.font = ImageFont.truetype('Minecraftia-Regular.ttf', 8) 
開發者ID:patrickpoirier51,項目名稱:OpenTracker,代碼行數:39,代碼來源:OpenMV-I2C.py


注:本文中的Adafruit_SSD1306.SSD1306_128_64屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。