1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry Pi で電子ペーパーを点けてみる (e-Paper ) その2

Last updated at Posted at 2020-01-08

Rapsberry pi で waveshare の 7.5inch e-Paper を点ける

試しただけで眠っていた e-Paper について、調べてみると使い方が違っていたみたいなので再度試してみる。
ケーブルの接続は旧記事を参照下さい → Raspberry Pi で電子ペーパーを点けてみる (e-Paper )
2020-01-08 時点の Raspberry Pi 4B で行いました。

必要なライブラリをインストール

readme_rpi_EN に書いてある必要なパッケージをインストール

% sudo apt update
% sudo apt install python3-pip
% sudo apt install python3-pil
% sudo apt install python3-numpy
% sudo pip3 install RPi.GPIO

※pip3 RPI.GPIO は 2020-01-08 現在、python3-rpi.gpio というパッケージが用意されています。

デモコード (含むライブラリ) をダウンロード & 伸張、展開

% wget https://github.com/waveshare/e-Paper/archive/master.zip
% unzip master.zip
% rm -rf e-Paper-master/Arduino e-Paper-master/STM32

Arduino や STM32 のフォルダは要らないのでとりあえず削除。

python3 のライブラリをインストール

% cd e-Paper-master/RaspberryPi\&JetsonNano/python/
% sudo python3 setup.py install

デモを実行

% cd examples/
% python3 epd_7in5bc_test.py

モノクロでよければ epd_7in5_test.py のデモコードも動きました。

画面クリアのコマンド

epd7in5b と epd7in5bc が共通化されたみたいです。
そして、import の方法が変わったり、Clear() に引数が不要になりました。
epd7in5b.EPD_WIDTH, epd7in5b.EPD_HEIGHT => epd.width, epd.height

# !/usr/bin/python3
from waveshare_epd import epd7in5bc

epd = epd7in5bc.EPD()
epd.init()
epd.Clear()
epd.sleep()
print("e-Paper clear & sleep done.")

epd.sleep() した後に epd.init() や、epd.Clear() を実行すると Bad file descriptor になります。
epd.sleep() のあとに、del epd して、epd = epd7in5bc.EPD() をやっても同様。
プログラミング中で sleep() が使えないようです。sleep() しなくて良くなったのかなぁ?

demo の中では最後しか実行していませんが。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?