一、前言
- 设置树莓派的分辨率,会发现网上教程的有些常规方式会无效,比如sudo raspi-config命令出来的设置窗口更改之后,重启发现分辨率并没有改变。这时候就需要特殊的手段去修改。
- 设置树莓派不自动休眠,一直开机
- 安装qt5
- qt5安装串口库
二、环境
树莓派3
三、正文
1 .树莓派设置任意分辨率
在终端输入sudo nano /boot/config.txt
找到如下位置
在这里更改为
hdmi_drive=2
hdmi_group=2
hdmi_mode=82
hdmi_mode 这里根据分辨率来设置,我选择的是1080p
按Ctrl+O保存,Ctrl+X退出
2.设置树莓派一直开机不待机
修改桌面配置文件lightdm.conf
sudo nano /etc/lightdm/lightdm.conf
其中,-s 参数:设置屏幕保护不启动,0 数字零,-dpms 参数:关闭电源节能管理。
保存退出:Ctrl+X,按Y 再按回车。
$sudo reboot
3.安装qt5
首先先更新源,先不要执行sudo apt-get update,否则最后耽误一些时间都是徒劳,最后还得重新更换源重复操作
更换的源文件在etc/apt/sources.list,下面任选其一即可
中科大
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
清华
deb https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
大连东软
deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
重庆大学
deb http://mirrors.cqu.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
浙江大学
deb http://mirrors.zju.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
阿里云
deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main contrib non-free rpi
搜狐
deb http://mirrors.sohu.com/raspbian/raspbian/ stretch main contrib non-free rpi
元智大学(中国台湾)
deb http://ftp.cse.yzu.edu.tw/Linux/raspbian/raspbian/ stretch main contrib non-free rpi
新加坡国立大学
deb http://mirror.nus.edu.sg/raspbian/raspbian/ stretch main contrib non-free rpi
北陆先端科学技术大学院大学(日本知名镜像站,日常出口带宽2g)
deb http://ftp.jaist.ac.jp/raspbian/ stretch main contrib non-free rpi
牛津大学
deb http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/ stretch main contrib non-free rpi
美国Berkely大学
deb http://mirrors.ocf.berkeley.edu/raspbian/raspbian/ stretch main contrib non-free rpi
美国俄克拉荷马大学
deb http://reflection.oss.ou.edu/raspbian/raspbian/ stretch main contrib non-free rpi
南非知名软件源
deb http://mirror.liquidtelecom.com/raspbian/raspbian/ stretch main contrib non-free rpi
默认源(带重定向by mirrorbrain)
deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi
官方源
deb https://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi
之后执行sudo apt-get update
完事执行sudo apt-get upgrade
完事执行sudo apt-get install qt5-default (我之前用默认源这里是显示无法定位软件包qt5-default的,后来更换了中科大的源,重复上面步骤到达这步时就成功安装qt配置文件了)
最后执行sudo apt-get install qtcreator
以上询问的地方全部y即可,最后更新qtcreator要464M空间
更新完毕之后打开qtcreator
之后配置qt的gcc和g++,添加gcc和g++ 目录usr/bin/arm-linux-guneabihf-gcc和g++
参考连接:https://blog.csdn.net/u014415522/article/details/80645651
之后可以使用了
4.qt5安装串口库
sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev
即可
四、结语
完美设置成功