树莓派GPIO用法示例(Python)

非阻塞用法示例如下:

参考链接


树莓派Zero W/WH(Raspberry Pi Zero W/WH) GPIO针脚定义

树莓派Zero W,有两款小型号,一款是Raspberry Pi Zero W,另一款是Raspberry Pi Zero WH,两者的区别是一个出厂的时候没有焊接排针,另一款焊接了排针。WWireless的缩写,WHWireless With Head的缩写。

树莓派Zero W/WH(Raspberry Pi Zero W/WH) GPIO针脚定义如下图:
继续阅读树莓派Zero W/WH(Raspberry Pi Zero W/WH) GPIO针脚定义

Raspberry Pi Zero W配置Wi-Fi AP

最近在配置Raspberry Pi Zero W,使用的系统为2018-06-27-raspbian-stretch-lite,我们的需求是把这台Raspberry Pi Zero W配置为开放Wi-Fi模式的AP

Raspberry Pi Zero W只有一块无线网卡,如果被配置成AP模式不是太好操作,可以通过预留的Macro USB接口外接一个USB有线网卡来实现远程访问,当然也可以直接接入显示器,USB Hub外接鼠标键盘操作。

执行如下脚本配置:

参考链接


树莓派2B启用I2C

树莓派自带I2C控制器,但是默认没有启用,我们需要手工启用,具体操作如下:

I2C is a very commonly used standard designed to allow one chip to talk to another. So, since the Raspberry Pi can talk I2C we can connect it to a variety of I2C capable chips and modules.Here are some of the Adafruit projects that make use of I2C devices and modules:

The I2C bus allows multiple devices to be connected to your Raspberry Pi, each with a unique address, that can often be set by changing jumper settings on the module. It is very useful to be able to see which devices are connected to your Pi as a way of making sure everything is working.

To do this, it is worth running the following commands in the Terminal to install the i2c-tools utility.

Installing Kernel Support (with Raspi-Config)

继续阅读树莓派2B启用I2C

树莓派上微雪屏幕虚拟键盘安装

买了个微雪7存屏幕,支持触摸,但是树梅派默认没有虚拟键盘,我们使用如下方式安装:

继续阅读树莓派上微雪屏幕虚拟键盘安装

raspberry pi新系统SSH连接被拒绝的解决方法

将全新的树莓派系统烧录,开机然后用SSH远程连接,结果SSH连接提示“connection refused”,导致连接树莓派失败。出现错误的原因是自2016-11-25官方发布的 Raspbian系统镜像,系统默认禁用了SSH服务。As of the November 2016 release, Raspbian has the SSH server disabled by default.

出错的详细信息为:

官方的解决方案是:

  • SSH disabled by default; can be enabled by creating a file with name "ssh" in boot partition

如果有显示器,开机后,在树莓派配置中将SSH开启即可。但在没有显示器,首次开机需要用SSH登陆的时候,就需要在系统烧录完毕后,进入到boot分区盘,新建一个名为ssh的空白文件就行了。

完成后再将SD卡插回树莓派,就可以正常使用SSH了。

也可以在树莓派系统上执行如下命令:

注意,最好在系统烧录完成后,立即执行上面的命令。重启过程中,会诱发磁盘检查,因此第一次重启会比较慢。另外,目前发现,如果后期安装了openssh-server再配置,会导致系统崩溃(2018-06-27-raspbian-stretch-lite)。

此文件会在重启完成后被自动删除。

默认的登录用户名pi 默认密码raspberry

参考链接


raspberry pi新系统SSH连接被拒绝的解决方法