由于公司项目中用到了树莓派pi3,在对其的使用中,遇到的一些问题进行记录,帮助自己也帮助他人。
第一个问题,也是本文的重点:树莓派对Wi-Fi的连接。
步骤一:修改interface文件
cd /etc/network/interfaces
sudo nano /etc/network/interfaces
修改配置如下:
auto loiface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static//静态地址
address 192.168.1.65
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf //wifi帐号密码文件
其中
auto lo //表示使用localhost
iface eth0 inet dhcp //表示如果有网卡ech0, 则用dhcp获得IP地址 (这个网卡是本机的网卡,而不是WIFI网卡)auto wlan0 //表示如果有wlan设备,使用wlan0设备名
allow-hotplug wlan0 //表示wlan设备可以热插拨
iface wlan0 inet dhcp //表示如果有WLAN网卡wlan0 (就是WIFI网卡), 则用dhcp获得IP地址
wpa-ssid “你的wifi名称”//表示连接SSID名
wpa-psk “你的wifi密码”//表示连接WIFI网络时,使用wpa-psk认证方式,认证密码
步骤二:输入
sudo /etc/init.d/networking restart
步骤三:重启系统,ok
曾经在配置过程中遇到一个问题:
配之后,输入:sudo ifup wlan0,提示:ignoring unknown interface wlan0=wlan0,那是因为iface wlan0 inet static这里写错了,我写成了iface default inet static
感谢这个链接和博主:
http://askubuntu.com/questions/342702/ignoring-unknown-interface-wlan0-wlan0
第二个问题:配置自启动谷歌浏览器和全屏显示
步骤一:配置图形界面中需要启动的Chrome:
cd /home/pi/.config
mkdir autostart
cd autostart
在[autostart]目录中新建名为my.desktop的文件:
sudo vi my.desktop
文件内容:
[Desktop Entry]
Type=Application
Exec=chromium-browser --disable-popup-blocking --no-first-run --disable-desktop-notifications --kiosk "http://www.baidu.com/"
上面的网址可以输入自己需要的URL, 保存退出, 重启:
sudo reboot
成功!