Adafruit OLED Bonnetで遊んでみた on Pi Zero

今日、「 [Adafruit 128x64 OLED Bonnet for Raspberry Pi](https://www.adafruit.com/product/3531) 」 と 「 [Pibow(ケース)](https://www.adafruit.com/product/3471)」がDHLによって家に届きました。
金曜日に買って月曜日に到着。
<blockquote class="twitter-tweet"><p lang="ja" dir="ltr">組み立てた <a href="https://t.co/1FCIMVhio5">pic.twitter.com/1FCIMVhio5</a></p>&mdash; はにおかさい(ｿﾌｨｽﾄ) (@haniokasai) <a href="https://twitter.com/haniokasai/status/1148125871628156930?ref_src=twsrc%5Etfw">July 8, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
軽く遊んでみることに。

#環境
Micro SD 8GB
Diet Pi (Debian Stretch)
Raspberry Pi Zero W

#インストール
```bash:導入コマンド一覧
sudo apt-get install python3-pip python3-rpi.gpio python3-pil i2c-tools make git
pip install setuptools board 
raspi-config #i2c を有効に。frequencyは100 or 400, and reboot
git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
cd Adafruit_Python_SSD1306
sudo python3 setup.py install
cd exa*
python3 stats.py #display にCPU使用率とかが表示される
```
<blockquote class="twitter-tweet"><p lang="ja" dir="ltr">表示ができたのでよかった <a href="https://t.co/bL5awZwCqc">pic.twitter.com/bL5awZwCqc</a></p>&mdash; はにおかさい(ｿﾌｨｽﾄ) (@haniokasai) <a href="https://twitter.com/haniokasai/status/1148195102193360896?ref_src=twsrc%5Etfw">July 8, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
#遊ぶ
```
root@DietPi:~/Adafruit_Python_SSD1306/examples# ls
animate.py #文字が流れる
happycat_oled_32.ppm 
happycat_oled_64.ppm
image.py　#appycat_oledを映す
stats.py #display にCPU使用率とかが表示される
buttons.py #ボタンテスト
shapes.py #図形の描写
```

```py:displayclear.py
# Copyright (c) 2017 Adafruit Industries
# Author: James DeVito
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import Adafruit_SSD1306
# Raspberry Pi pin configuration:
RST = 24
# 128x32 display with hardware I2C:
#disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
# 128x64 display with hardware I2C:
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
# Initialize library.
disp.begin()

# Get display width and height.
width = disp.width
height = disp.height

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

#まとめ
Virtual Keyboardを自作してみたい。

#See Also
http://purose.net/fanout/index.php?OLED%20を%20Raspberry%20Pi%20のコンソールにする

#Ref
https://www.qoosky.io/techs/2316d68b2e
https://qiita.com/masato/items/715e28e0c0c945a54297
https://qiita.com/KZ2/items/ebfcb90406d1a4ba539f
https://learn.adafruit.com/adafruit-128x64-oled-bonnet-for-raspberry-pi/usage
https://wiki.debian.org/CrossToolchains