8.OLED画面にPythonでの接続方法

①ラズベリーパイにSSH接続
②OLED画面(mh_z19)用のPython3用ライブラリ追加	
サンプルソース
「wget https://github.com/h-nari/raspioled/archive/refs/heads/master.zip」
mv master.zip raspioled-master.zip
unzip raspioled-master.zip

raspioled-master
└ examples
   ├── 00_text.py
   ├── 01_lines.py
   ├── 02_kanji.py
   ├── 03_scroll_text.py
   ├── image.py
   └── rssDisp.py

「python3  00_text.py」を実行。
「
#!/usr/bin/python

import RaspiOled.oled as oled;
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

image = Image.new('1',oled.size)  # make 128x64 bitmap image
draw  = ImageDraw.Draw(image)
f10 = ImageFont.truetype(
    font='/usr/share/fonts/truetype/freefont/FreeMono.ttf',
    size=12)
f20 = ImageFont.truetype(
    font='/usr/share/fonts/truetype/freefont/FreeSerif.ttf',
    size=20)
f40 = ImageFont.truetype(
    font='/usr/share/fonts/truetype/freefont/FreeSans.ttf',
    size=40)
draw.text((0, 0), "Hello Raspberry Pi", font=f10, fill=255)
draw.text((0,10), "Hello OLED", font=f20, fill=255)
draw.text((0,26), "Hello", font=f40, fill=255)
oled.begin()
oled.image(image)
」入力してリターン
	
③CO2測定結果をOLEDに表示	
文字列を128x64のイメージを作成してOLEDにセット。
日本語文字をOLEDにセット。
画像イメージをOLEDにセット。

