今日、「 Adafruit 128x64 OLED Bonnet for Raspberry Pi 」 と 「 Pibow(ケース)」がDHLによって家に届きました。
金曜日に買って月曜日に到着。
軽く遊んでみることに。組み立てた pic.twitter.com/1FCIMVhio5
— はにおかさい(ソフィスト) (@haniokasai) July 8, 2019
環境
Micro SD 8GB
Diet Pi (Debian Stretch)
Raspberry Pi Zero W
インストール
導入コマンド一覧
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使用率とかが表示される
# 遊ぶ ``` 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 #図形の描写 ```表示ができたのでよかった pic.twitter.com/bL5awZwCqc
— はにおかさい(ソフィスト) (@haniokasai) July 8, 2019
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
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