花生壳|学生党进阶指南:用闲置树莓派远程开发51单片机( 二 )


sudo apt-get install git
#获取novnc的源码
git clone https://github.com/kanaka/noVNC
进入novnc的目录
cd noVNC
运行novnc(第一次运行的时候会下载一个端口转发的程序可能需要一些时间)
./utils/launch.sh --vnc localhost:5901
4. 安装51开发环境
这里的开发环境依赖python3,需要确保已安装python3, pip3.
如果没有下载pip3请下载安装
安装sdcc
sudo apt-get install sdcc
编译程序例子:
sdcc 1.c
安装hex2bin(如果是不是专业开发者感觉可以不安装)
百度网盘分享地址:https://pan.baidu.com/s/1iky8HsB-nVn1p5J3EzB8NQ
提取码:tg3v
安装pyserial
sudo pip3 install pyserial
安装stcgal
pip3 install stcgal
测试
stcgal -h
#下载程序样例(建议完成安装ch340后在进行下载测试)
stcgal 1.ihx
5. 树莓派安装CH340驱动
驱动下载官方网址(linux版本)
http://www.wch.cn/download/CH341SER_LINUX_ZIP.html
cd 进入文件夹
安装依赖环境
sudo apt-get install linux-headers
修改make文件
打开ch34x.c源码,添加#include <linux/sched/signal.h>,并注释掉waitqueuet wait
编译并加载驱动
make
make load
6. 安装usb摄像头监控界面
sudo apt-get install motion
然后打开 motion daemon 守护进程,让他可以一直在后台运行:
sudo nano /etc/default/motion
#no修改成yes:
start_motion_daemon=yes
修改motion的配置文件:
sudo vim /etc/motion/motion.conf
#deamon off 改成 on
deamon on
#设置分辨率
width 800
height 600
#关闭 localhost 的限制
webcam_localhost off
然后运行 motion:
sudo motion
现在我们的摄像头已经变成了一台网络摄像头 。在chrome浏览器下访问 http://[your.domain]:8081 即可看到摄像头当前拍摄的画面 。
7. 简单修改noVNC界面
在noVNC源码的app目录下面添加camera文件夹
这里是jq的一个小插件实现了一个可以拖动的小框框
链接:https://pan.baidu.com/s/1VZSh14pUXK36NcxrYTM1-A
提取码:swk9
最后修改vnc.html文件让我们把摄像头和远程界面合二为一
<!DOCTYPE html>
<html lang="en" class="noVNC_loading">
<head>
<!--
noVNC example: simple example using default UI
Copyright (C) 2019 The noVNC Authors
noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
Connect parameters are provided in query string:
http://example.com/?host=HOST&port=PORT&encrypt=1
or the fragment:
http://example.com/#host=HOST&port=PORT&encrypt=1
-->
<title>noVNC</title>
<meta charset="utf-8">
<!-- Icons (see app/images/icons/Makefile for what the sizes are for) -->
<link rel="icon" sizes="16x16" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-16x16.png">
<link rel="icon" sizes="24x24" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-24x24.png">
<link rel="icon" sizes="32x32" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-32x32.png">
<link rel="icon" sizes="48x48" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-48x48.png">
<link rel="icon" sizes="60x60" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-60x60.png">
<link rel="icon" sizes="64x64" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-64x64.png">
<link rel="icon" sizes="72x72" type="image/png" href=https://news.mydrivers.com/1/790/"app/images/icons/novnc-72x72.png">