zoukankan      html  css  js  c++  java
  • wifi遥控小车的制作

    第一步:装上op系统,将路由器连接上网,然后安装stty

    opkg update
    opkg install coreutils-stty

    在CC的系统中可能安装后无法使用,可以使用BB系统,如无法下载软件可直接前往官网下载或wget网页上相关软件。

    第二步:修改串口波特率

    stty -F /dev/ttyAth0 raw speed 9600

    第四步:页面控制

    lua控制部分(文件名web2ser,放在/www/cgi-bin目录下)

    #!/usr/bin/lua
    io.output("/dev/ttyATH0")
    c =  os.getenv("QUERY_STRING")
    
    io.write("ZY")
    io.write(c)
    io.write("WV")
    

    网页代码(放在/www/目录下)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    div#buttons{1200px; height:500px; float:left;}
    input#forward{ 200px; height: 200px; position: fixed; left: 500px;top: 20px}
    input#left{ 200px; height: 200px; position: fixed; left: 100px;top: 150px}
    input#right{ 200px; height: 200px; position: fixed; left: 900px;top: 150px}
    input#back{ 200px; height: 200px; position: fixed; left: 500px;top: 360px}
    input#stop{ 200px; height: 200px; position: fixed; left: 900px;top: 360px}
    </style>
    	<script>
    	function sendSer(value){
    	document.getElementById("ser").src="http://192.168.10.1/cgi-bin/web2ser?"+value;
    	}
    	</script>
    </head>
    
    
    <body>
    	
    <div id="container">
    	<div id="buttons">
    		<img id="ser" width="1" height="1" />
    		<input id="forward"type="button" ontouchstart="sendSer('B')" ontouchend="sendSer('S')" value="前进" align="left" />
    		<input id="left"type="button" ontouchstart="sendSer('L')" ontouchend="sendSer('S')"  value="向左" align="left" />
    		<input id="right"type="button" ontouchstart="sendSer('R')" ontouchend="sendSer('S')"  value="向右" align="left" />
    		<input id="back"type="button" ontouchstart="sendSer('F')" ontouchend="sendSer('S')"  value="后退"align="left" />
    		<input id="stop"type="button" ontouchstart="sendSer('S')" onmousedown="sendSer('S')" value="停止" align="left" />
    	</div>
    </div>
    </body>
    
    </html>
    

    修改index.html让其指向控制页面

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="refresh" content="0; URL=/car.html" />
    </head>
    <body style="background-color: black">
    <a style="color: white; text-decoration: none" href="/car.html">LuCI - Lua Configuration Interface</a>
    </body>
    </html>
    

      

  • 相关阅读:
    2016年10月30日表单标签与样式表分类和选择器
    2016年10月29日常用标签与表格
    2016年10月28日网页属性和通用标签
    10月27日体会目标
    字符串学习笔记
    [51nod1789] 跑得比谁都快
    [洛谷9月月赛]签到题
    [LUOGU2730] 魔板
    [SCOI2009]迷路
    [51nod1074] 约瑟夫问题 V2
  • 原文地址:https://www.cnblogs.com/FreedomBox/p/4734621.html
Copyright © 2011-2022 走看看