论坛的PI2也到了
有时间就慢慢玩玩这块传感器板子
依然是树莓派的基本套路
各种依赖的安装
更新apt-get:
$ sudo apt-get update $ sudo apt-get upgradeSense Hat软件包安装
$ sudo apt-get install sense-hatPillow安装,不过要确认操作系统已经安装了python3
似乎python2无福消受啊
$ sudo pip-3.2 install pillow安装pillow的时候,可能会出错
忘记截图了
大概意思是说没找到jpeg的支持
有更新源直接搞定
$ sudo apt-get install libjpeg-dev再次安装pillow,一切顺利
完成安装后,最好reboot一下
然后开始RGB矩阵显示
先来个简单的文本
nano一个test.py
from sense_hat import SenseHat sense = SenseHat() sense.show_message("Hi,Ickey!")运行一下
python3 test.py效果图
发光强度比较大
加上gif帧数有限
效果一般
再来个温湿度压力传感器数据显示
from sense_hat import SenseHat sense=SenseHat() while True: t=sense.get_temperature() p=sense.get_pressure() h=sense.get_humidity() t=round(t,1) p=round(p,1) h=round(h,1) msg="T=%s,P=%s,H=%s"%(t,p,h) sense.set_rotation(0) sense.show_message(msg,scroll_speed=0.01)温度、湿度和压力滚动快速显示
gif帧数比较少
把API文档也找出来瞧了瞧
各种功能接口都有
回复下载吧
又试了试不同方向的显示
蛮有意思的
from sense_hat import SenseHat sense=SenseHat() while True: t=sense.get_temperature() p=sense.get_pressure() h=sense.get_humidity() t=round(t,1) p=round(p,1) h=round(h,1) msg1="T=%s"%(t) msg2="P=%s"%(p) msg3="H=%s"%(h) msg4="Bye" sense.set_rotation(0) sense.show_message(msg1,scroll_speed=0.03) sense.set_rotation(90) sense.show_message(msg2,scroll_speed=0.03) sense.set_rotation(180) sense.show_message(msg3,scroll_speed=0.03) sense.set_rotation(270) sense.show_message(msg4,scroll_speed=0.03)上GIF
这次把帧数调高了
没有出现断字的现象
下次接着玩
感谢分享