老師羅金榮
HTML 標記語言
CSS
JACASCRIPT
JQUERY
JQUERY UI
MCU
nodemcu-->GPIO-->模組
10/24
<script language="javascript">
function fun1()
{
alert("程式已被驅動");
}
</script>
</head>
<body>
<ol type="a">
<li><font color="#CC33FF">數位訊號</font></li>
<li><b>類比訊號</b></li>
<li><i>序列訊號</i></li>
</ol>
<p></p>
<ul type="disc">
<li>GPIO-2</li>
<li>GPIO-4</li>
<li>GPIO-5</li>
</ul>
<p></p>
<a href="http://www.google.com">GOOGLE</a>
<p></p>
<a href="hsub1.html">到子網頁</a>
<p></p>
<a href="javascript:void;" onclick="fun1()")>確定</a>
<p></p>
<a href="hsub1.html">
<img src="image/s1.jpg" width="80" height="50" />
</a>
<table border="2" width="200" height="100" >
<tr>
<td align="center">A</td>
<td align="center" valign="top">B</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFF00">C</td>
<td align="center" valign="bottom" bgcolor="#FFFFCC">D</td>
</tr>
</table>
</body>
</html>
=================================
hsub1.html
<body>
子網頁內容
<p></p>
<a href="hchin1.html">回首頁</a>
</body>
++++++++++++++++++++++++++++++++++++++++++
10/29
<p></p>
<table border="2" width="500">
<tr>
<td colspan="5" bgcolor="#CC66FF">作品集一</td>
</tr>
<tr>
<td>編號 </td>
<td>作者 </td>
<td>地點 </td>
<td>日期 </td>
<td rowspan="6">
<img src="image/s2.jpg" width="200" height="150"/>
</td>
</tr>
<td>S1001</td>
<td>張三</td>
<td>阿里山</td>
<td>2019/8/3</td>
<tr>
<td>S1002</td>
<td>李四</td>
<td>合歡山</td>
<td>2018/5/12</td>
</tr>
<tr>
<td>S1003</td>
<td>晨五</td>
<td>系頂</td>
<td>2104/9/3</td>
</tr>
<tr>
<td>S1004</td>
<td>人五</td>
<td>墾丁</td>
<td>2018/9/7</td>
</tr>
<tr>
<td>S1005</td>
<td>吳耿華</td>
<td>合歡山</td>
<td>2018/9/5</td>
</tr>
<tr>
<td colspan="5" align="right" bgcolor="#CC66FF">狀態列</td>
</tr>
</table>
+++++++++++++++++++++++++++++++++++++++
<form id="f1" name="f1" method="post">
<table border="2" width="200">
<tr>
<td>姓名
</td>
<td>
<input type="text" id="t1" name="t1" size="20" />
</td>
</tr>
<td colspan="2">
<input type="button" id="bt1" name="bt1" value="確定" />
<input type="button" id="bt2" name="bt2" value="清除"
/> </td>
<tr>
</tr>
</table>
</form>
___________________________________________
10/31
排版元件
<div id="">
</div>
css宣告:
<style type="text/css">
元件{
屬性:屬性值
}
</style>
-------------------------------
tag
p{ color:#0CF;
font-size:30px;
}
------------------
id
#p3,#p1{ color:#0CF;
font-size:30px;
border:#993;
border-style:double;
border-width:5px;
width:150px;
}
-----------------------------------
指定重複休市
------------
<style type="text/css">
#dv1{
width:200px;
height:150px;
background-color:#F9C;
border-radius:50px 50px 50px 50px; /* 可用來製作按鈕 */
}
</style>
</head>
<body>
<div id="dv1">
</div>
-------------------------------------
圓角修飾
border-radius:50px 50px 50px 50px
內部修飾
padding
外部修飾
margin
-----------------------------
<style type="text/css">
#dv1{
width:80px;
height:30px;
background-color:#F9C;
border-radius:50px 50px 50px 50px;
text-align:center;
padding-top:10px;
}
</style>
</head>
<body>
<div id="dv1">
開啟
</div>
---------------------------------
<style type="text/css">
#dv1{
width:80px;
height:30px;
background-color:#F9C;
border-radius:50px 50px 50px 50px;
text-align:center;
padding-top:10px;
font-size:14px;
}
#dv1:hover{
background-color:#33F;
}
a{
text-decoration:none;
}
</style>
</head>
<script language="javascript">
function fun1()
{
alert("bt被執行")
}
</script>
<body>
<a href="javascript:void;" onclick="fun1()" />
<div id="dv1">
開啟
</div>
</body>
________________________________
overflow:scroll
出現卷軸
------------
製作水平選單
<style type="text/css">
#ul1{
list-style:none;
}
#ul1 li{
display:inline;
margin-left:50px;
}
</style>
</head>
<body>
<ul type="disc" id="ul1">
<li>LED!</li>
<li>LED2</li>
<li>LED3</li>
<li>LED4</li>
<li>LED5</li>
</ul>
</body>
_______________
#dv1{
width:80px;
height:30px;
background-color:#F9C;
border-radius:50px 50px 50px 50px;
text-align:center;
padding-top:10px;
font-size:14px;
}
#dv1:hover{
background-color:#33F;
}
a{
text-decoration:none;
}
</style>
</head>
<script language="javascript">
function fun1()
{
alert("bt被執行")
}
</script>
<body>
<a href="javascript:void;" onclick="fun1()" />
<div id="dv1">
開啟
</div>
</body>
________________________________
overflow:scroll
出現卷軸
------------
製作水平選單
<style type="text/css">
#ul1{
list-style:none;
}
#ul1 li{
display:inline;
margin-left:50px;
}
</style>
</head>
<body>
<ul type="disc" id="ul1">
<li>LED!</li>
<li>LED2</li>
<li>LED3</li>
<li>LED4</li>
<li>LED5</li>
</ul>
</body>
_______________
list-style:none;
width:500px;
background-color:#3CF;
}
#ul1 li{
display:inline;
margin-right:50px;
}
#ul1 li:hover{
font-size:24px;
color:#03F;
}
</style>
-------------------
11/05
javascript
資料型態
Integer,Float,Blooean,String,Array
變數宣告
var 變數名稱;
ui元件
alert("輸出資料");
promp("");
confirm("");
window.open("");
<script language="javascript">
function fun1()
{
alert("first javascript");
}
</script>
<body>
<a href="javascript:void" id="a1" onclick="fun1()" >執行</a>
</body>
________________________
DOM文件物件模型
<span>,<a>,<img>,<p>,<div>,<ol>,<ul>
1.以ID取值
取值 var k=document.getElementById("id").innerHTML
給值 document.getElementById("id").innerHTML=值
2.
一‧取單項值:文字框,下拉是選單,備忘框
取值 var k=document.getElementById("id").value
給值 document.getElementById("id")..value=值
二‧群組或複選取值
var klen=document.getElementByName("rd").length;
document.getElementByName("rd").item(i) 取得群組項目的物件
document.getElementByName("rd").item(i).checked ;判斷被選取
var kv=document.getElementByName("rd").item(i).value
trim() 左右去空白
ltrim()左
rtrim()右
<p id="p1">30</p>
<span id="sp1">80</span>
<div id="dv1"></div>
k=document.getElementById("p1").innerHTML //k=30取值
var t=80;
document.getElementById("sp1").innerHTML=t
___________________________
<script language="javascript">
function fun1()
{
var score;
score=prompt("請輸入成績:");
var t=document.getElementById("sp1");
t.innerHTML=score
}
</script>
<body>
<span id="sp1"></span>
<p>
<a href="javascript:void" id="a1" onclick="fun1()" >執行</a>
______________________________
變數資料來源
1指定
2.網路
3.網頁元件
4.表單
5.輸入對話方塊
資料型態轉換
parseInt()
parseFloat()
parseDouble()
Number()
String()
__________________
function fun1()
{
var t1=document.getElementById("sp1").innerHTML;
var t2=document.getElementById("sp2").innerHTML;
var total=parseInt(t1)+parseInt(t2);
alert(total);
document.getElementById("sp3").innerHTML=String(total);
}
</script>
<body>
<span id="sp1">36</span>
<p>
<span id="sp2">48</span>
<p>
相加總值;<span id="sp3">0</span>
<p>
<a href="javascript:void" id="a1" onclick="fun1()" >執行</a>
__________________
運算子
1算數
2關係
3邏輯
4指定
5位元&,|
6條件 (條件式)?"結果一":"結果二"
7遞增++
遞減--
var t=76;
var k=(t>=60)?"及格":"不及格";
var num;
num=prompt("請輸入成績:");
var k=num/2==0?"偶數":"奇數";
alert(k);
var score=parseInt(prompt("請輸入成績:"));
var k=(score>=90)?"甲級":(score>=80)?"乙級":(score>=70)?"丙級":(score>=60)?"丁級":"不及格";
//可巢狀判斷
k++
++k
++++++++++++++
11/07
and or not
var k=20;
var t=90;
z=(k>=60) && (t<=100);//false
z=(k>=60) || (t<=100);//true
z=!((k>=60) || (t<=100));//false
---------------------------------------
+= -= *= /= 複合運算子
位元運算子
var t=5;
var k=3;
var total=t | k; //var total=t & k; 為1 |為7
____________________________
if 指令
var k=confirm("清除 資料嗎?;");
if(k==true)
{
document.getElementById("sp1").innerHTML="清除";
}
else
{
document.getElementById("sp1").innerHTML="不";
}
}
</script>
<body>
<input type="button" id="bt1" name="bt1" value="執行" onclick="fun1()" />
<p></p>結果;
<span id="sp1"></span>
+++++++++++++++++++++++++++
Number.isNaN(NaN) == true-----------------------------------
switch
var ch=prompt("輸入1.春2.夏3.秋4.冬 的花類.");
result="";
switch ((parseInt(ch)))
{
case 1:
{
result="梅花";
break;
}
case 2:
{
result="梅花";
break;
}
case 3:
{
result="梅花";
break;
}
case 4:
{
result="梅花";
break;
}
}
document.getElementById("sp1").innerHTML=result;
}
</script>
<body>輸入四季花類;
<input type="button" id="bt1" name="bt1" value="執行" onclick="fun1()" />
<p></p>結果;
<span id="sp1"></span>
______________________________________
for
<script language="javascript">function fun1()
{
var str="";
for(var i=1;i<=10;i++)
{
str=str+i+" "
}
//alert(str);
document.getElementById("sp1").innerHTML=str;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >執行</a>
<p></p>
<span id="sp1"></span>
----------------------------------
array
重點
1.總長度;陣列名稱.length,回整數值
2.輸出正迴圈,逆迴圈
3.輸入
HTML元件,表單,網路元件
4.邏輯
最大,最小,排序,搜尋
<script language="javascript">
function fun1()
{
var a=new Array(66,55,3,99,50);//直接表示法
a.sort();
a.reverse();//逆排序(sort(),reverse()一起)
str="";
for(var i=0;i<a.length;i++)
{
str=str+a[i]+" ";
}
alert(str);
}
</script>
<body>
<a href="javascript:void" id="a1" onclick="f
__________________________
<script language="javascript">
function fun1()
{
var a=[];//間接表示法,先決定記憶體空間再給值
var len1=document.getElementsByTagName("span").length;
for (var i=0;i<len1;i++)
{
a[i]=parseInt(document.getElementById("sp"+(i+1)).innerHTML);
}
var max=0;
for(var i=0;i<len1;i++)
{
if(max<a[i])
{
max=a[i];
}
}
alert("最大值"+max);
//alert(a);
}
</script>
<body>
<span id="sp1">66</span>
<p></p>
<span id="sp2">55</span>
<p></p>
<span id="sp3">3</span>
<p></p>
<span id="sp4">99</span>
<p></p>
<span id="sp5">50</span>
<p></p>
<a href="javascript:void;" id="a1" onclick="fun1()" >執行</a>
</body>
___________________________
<script language="javascript">
function fun1()
{
var a=new Array(10,20,30,40,50);
var len1=a.length;
var str="";
for (var i=0;i<len1;i++)
{
str+=a[i]+" ";
}
document.getElementById("sp1").innerHTML=str;
}
function fun2()
{
var a=new Array(10,20,30,40,50);
var len1=a.length;
var str="";
for (var i=len1-1;i<0;i--)
{
str+=a[i]+" ";
}
document.getElementById("sp1").innerHTML=str;
}
</script>
<body>
<a href="javascript:void" id="a1" onclick="fun1()" >正迴圈取值</a>
<a href="javascript:void" id="a2" onclick="fun2()" >逆迴圈取值</a>
<p></p>
<span id="sp1"></span>
</body>
___________________
<script language="javascript">
function fun1()
{
var a=[];
a.push(parseInt(document.getElementById("sp1").innerHTML));
a.push(parseInt(document.getElementById("sp2").innerHTML));
a.push(parseInt(document.getElementById("sp3").innerHTML));
a.push(parseInt(document.getElementById("sp4").innerHTML));
a.push(parseInt(document.getElementById("sp5").innerHTML));
str="";
for(var i=0;i<a.length;i++)
{
str=str+a[i]+" ";
}
alert(str);
var max=0;
for(var i=0;i<a.length;i++)
{
if(max<a[i])
{
max=a[i];
}
}
alert("最大值"+max);
//alert(a);
}
</script>
<body>
<span id="sp1">66</span>
<p></p>
<span id="sp2">55</span>
<p></p>
<span id="sp3">3</span>
<p></p>
<span id="sp4">99</span>
<p></p>
<span id="sp5">50</span>
<p></p>
<a href="javascript:void;" id="a1" onclick="fun1()" >執行</a>
</body>
----------------------
11/14
函數
1.架構一 無參數無回傳值 變數為全域
2.架構二 有參數無回傳值
3.架構三 無參數有回傳值
4架構四有參數有回傳值
5.學習重點
1.程式易於維護
2.元件撰寫和設計\
3功能整理
DOM文件物件模型
1.以id方式取值
<span id-"sp2">程式</span>
a.取值
document.getElementById("sp1").innerHTML;
b.給值
document.getElementById('sp1").innerHTML=值
.
架構一;全域變數
<script language="javascript">
var t=50;
function fun1()
{
var t=20;
document.getElementById("sp1").innerHTML=t;
fun2()
}
function fun2()
{
document.getElementById("sp2").innerHTML=t;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >執行</a>
<p></p>
<span id="sp1"></span>
<p></p>
<span id="sp2"></span>
_________________________________
架構二 區域變數
<script language="javascript">
function fun1()
{
var a=30
var b=80;
fun2(a,b)
}
function fun2(x,y)
{
var t=x+y;
document.getElementById("sp1").innerHTML=t;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >架構二</a>
<p></p>
<span id="sp1"></span>
__________________
架構三 區域變數
<script language="javascript">
function fun1()
{
var t=fun2();
document.getElementById("sp1").innerHTML=t;
}
function fun2(x,y)
{
var x=20;
var y=70;
var sum=x*y;
return sum;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >架構三</a>
<p></p>
<span id="sp1"></span>
______________________
架構四
<script language="javascript">
function fun1()
{
var a=70;
var b=20
var t=fun2(a,b);
document.getElementById("sp1").innerHTML=t;
}
function fun2(x,y)
{
var sum=x+y;
return sum;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >架構四</a>
<p></p>
<span id="sp1"></span>
_______________________________________
funcom4.js
// JavaScript Document
function fun2(x,y)
{
var sum=x*y+100;
return sum;
}
_______________function fun1()
{
var a=70;
var b=20
var t=fun2(a,b);
document.getElementById("sp1").innerHTML=t;
}
function fun2(x,y)
{
var sum=x+y;
return sum;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >架構四</a>
<p></p>
<span id="sp1"></span>
_______________________________________
funcom4.js
// JavaScript Document
function fun2(x,y)
{
var sum=x*y+100;
return sum;
}
<script language="javascript" src="funcom4.js"></script> //引入js檔
<script language="javascript">
function fun1()
{
var a=70;
var b=20
var t=fun2(a,b);
document.getElementById("sp1").innerHTML=t;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >架構四</a>
<p></p>
<span id="sp1"></span>
_____________________________
_<script language="javascript">
function fun1()
{
var k=new Array(11,12,13,14,15);
fun2(k);
}
function fun2(b)
{
var blen=b.length;
var str="";
for (var u=0;u<blen;u++)
{
str=str+b[u]+" ";
}
document.getElementById("sp1").innerHTML=str;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >陣列傳值</a>
<p></p>
<span id="sp1"></span>
<script language="javascript">
function fun1()
{
var a=fun2();
var alen=a.length;
alert(a);
var str="";
for (var u=0;u<alen;u++)
{
str=str+a[u]+" ";
}
document.getElementById("sp1").innerHTML=str;
}
function fun2()
{
var t=new Array(12,34,56,78,10);
return t;
}
</script>
<body>
<a href="javascript:void;" id="a1" onclick="fun1()" >陣列回傳值</a>
<p></p>
<span id="sp1"></span>
_________________________
DOM表單元件取值
一.取單項值:文字框/下拉式選單
二群組或複選取值 單選鈕 /核取方塊
var klen=document.getElementsByName("rd").length;
計算長度
docment.getElementsByName("rd").item(i)
取得群組項目
docment.getElementsByName("rd").item(i).checked
判斷是否被選取
docment.getElementsByName("rd").item(i).value
向項目取選取的值
<script language="javascript">
function fun1()
{
var n=document.getElementById("t1").value.trim();
if (n !="")
{
alert(n)
}
else
{
alert("請輸入姓名")
document.getElementById("t1").value="";
document.getElementById("t1").focus();
}
}
function fun2()
{
document.getElementById("t1").value="";
document.getElementById("t1").focus();
}
</script>
<body>
<form id="f1" name="f1">
<input type="text" id="t1" name="t1" size="20" ? />
<p></p>
<input type="button" id="bt1" value="確定" onclick="fun1()" />
<input type="button" id="bt2" value="清除" onclick="fun2()" />
</form>
______________________
11/19
<script language="javascript">
function fun1()
{
var str="";
var s=document.getElementsByName("chk").length;
for (var i=0;i<s;i++)
{
if (document.getElementsByName("chk").item(i).checked=true)
{
str=str+document.getElementsByName("chk").item(i).value+" ";
}
}
alert(str);
}
function fun2()
{
var s=document.getElementsByName("chk").length;
for (var i=0;i<s;i++)
{
document.getElementsByName("chk").item(i).checked=false;
}
}
</script>
<body>
<form id="f1" name="f1" >
<table border="2" width="500" id="tbl1">
<tr>
<td>
<input type="checkbox" name="chk" id="chk1" value="英文" />英文
<input type="checkbox" name="chk" id="chk2" value="國文" />國文
<input type="checkbox" name="chk" id="chk3" value="數學" />數學
<td>
<input type="button" id="bt1" name="bt1" value="確定" onclick="fun1()" />
<input type="button" id="bt2" name="bt2" value="清除"
onclick="fun2()" />
</td>
</tr>
</table>
</form>
---------------------
function fun1()
{
var k=document.getElementById("ta1").value.trim();
if (k!="")
{
var len=k.length;
if (k<=50)
{
alert(k);
}
else
{
alert("超出長度");
}
}
else
{
alert("輸入備忘資料")
}
}
function fun2()
{
document.getElementById("ta1").value=" ";
}
function fun3()
{
var k=document.getElementById("ta1").value.trim();
var klen=k.length;
document.getElementById("sp1").innerHTML=klen;
}
</script>
<body>
<form>
<fieldset>
<legend>備忘資料:</legend>
<table border="1" width="300">
<tr><td></td></tr>
<tr><td>備忘錄:只限50個字</td></tr>
<tr><td ><textarea id="ta1" cols="80" rows="15" oninput="fun3()"></textarea>
</td>
</tr>
<tr>
<td>
<input type="button" id="bt1" name="bt1" value="確定" onclick="fun1()" />
<input type="button" id="bt2" name="bt2" value="清除"
onclick="fun2()" />
</td>
</tr>
</table>
<span id="sp1"></span>
</fieldset>
</form>
------------
Jquery基本使用方法和傳輸
一、引入函數庫
<<script language="javascript" src="jquery-3.4.1.min.js"></script>
二、架構
$(document).ready(function()
{
[程式區塊]
});
$(document)==>選擇器
三、選擇器
a.id-->$("#id")
b.class-->$(".class")
c.tagname-->$("tagname")
<a> onclick func1()==========>javascript
物件 事件 函數
#選擇器 click function()========>Jquery
下載Jquery compress檔,放於相關資料夾
一、text()===>靜態元件取值
以text()函數取值和給值
<a>,<span>,<ol>,<ul>,<div>,<p>,<table>....
(a)取值var k=$("選擇器").text()
(b)給值 $("選擇器").text(值)
二、val()==>表單元件
text,textarea,select,radio,checkbox..
以val()函數取值和給值
(a)取值var k=$("選擇器").val()
(b)給值 $("選擇器").val(值)
三、attr()-->元件屬性
<script language="javascript" src="jquery-3.4.1.min.js"></script>
<script language="javascript">
function fun1()
{
var q=$("#a1").text();
var s=confirm("確定要上嗎?");
if (s==true)
{
location.href="https://www.microsoft.com/taiwan/about/";
}
}
</script>
<body>
<input type="button" id="btn1" value="指向網站" onclick="fun1()" />
<p></p>
<a href="" id="a1" >台灣微軟</a>
</body>
-----------------------------------
<script language="javascript" src="jquery-3.4.1.min.js"></script>
<script language="javascript">
$(document).ready(function()
{
$("#btn1").click(function()
{
var q=$("#a1").text();
var s=confirm("確定要上嗎?");
if (s==true)
{
location.href="https://www.microsoft.com/taiwan/about/";
}
});
});
</script>
<body>
<input type="button" id="btn1" value="指向網站" />
<p></p>
<a href="" id="a1" >台灣微軟</a>
</body>
------------------------------------------------
<script language="javascript" src="jquery-3.4.1.min.js"></script>
<script language="javascript">
$(document).ready(function()
{
$("#btn1").click(function()
{
$("#a1").attr("href","https://www.microsoft.com/taiwan/about/");
alert("網址設定完成");
});
});
</script>
<body>
<input type="button" id="btn1" value="設網站" />
<p></p>
<a href="#" id="a1" >台灣微軟</a>
</body>
====
<script language="javascript" src="jquery-3.4.1.min.js"></script>
<script language="javascript">
$(document).ready(function()
{
$("#btn1").click(function()
{
$("#ol1").each(function(i,e)
{
alert($(this).text());
});
});
});
</script>
<body>
<input type="button" id="btn1" value="取ol值" />
<p></p>
<ol id="ol1" >
<li>程式設計</li>
<li>美工設計</li>
<li>系統設計</li>
<li>繪圖設計</li>
<li>資料庫設計</li>
</ol>
ESP8266 12E
1
C槽放ardunoIDE 從google下載arduino1.8.10 直接解壓縮
2.espdriver.7z解壓縮 安裝cp210xvcpinstall_x64.exe
再到裝置管理員安driver 2l3combort
3.設資料夾IOTHMIproject1
4.開arduino.exe
a .檔案偏好設定
貼開發板管理員位址
http://arduino.esp8266.com/stable/package_esp8266com_index.json
b.工具-開發版管理員 安裝2.3版
NodeMcu1.0(ESP-12Emodule)
速度115200
cpu 80MHz
flash 4m
===============================
測試上網
#include<ESP8266WiFi.h>
#include<ESP8266WebServer.h>
ESP8266WebServer server(80);
char ssid[]="bsnet-1";
char pass[]="062230542";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.begin(ssid,pass);
delay(3000);
server.on("/",fun1);
server.begin();
Serial.println();
Serial.println(WiFi.localIP());
}
void fun1()
{
Serial.println();
server.send(200,"text/html","Hello Webserver");
}
void loop() {
// put your main code here, to run repeatedly:
server.handleClient();
}
+++++++++++++++++++++++++++++++++++++++
ESP8266-12E
c++
======
1205
hmibasic8 hmi UI
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>
<link rel="stylesheet" href="./hmili/jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="./jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="./hmili/jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="./hmili/jqwidgets/jqxdraw.js"></script>
<script type="text/javascript" src="./hmili/jqwidgets/jqxknob.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#knob').jqxKnob({
value: 60,
min: 0,
max: 255,
startAngle: 150,
endAngle: 510,
snapToStep: true,
rotation: 'clockwise',
style: { stroke: '#dfe3e9', strokeWidth: 3, fill: { color: '#fefefe', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] } },
marks: {
colorRemaining: '#333',
colorProgress: '#333',
type: 'line',
offset: '71%',
thickness: 1,
size: '6%',
majorSize: '9%',
majorInterval: 10,
minorInterval: 2
},
labels: {
offset: '88%',
step: 10
},
progressBar: {
style: { fill: { color: '#00a644', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }, stroke: '#00a644' },
background: { fill: { color: '#ff8b1e', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }, stroke: '#ff8b1e' },
size: '9%',
offset: '60%'
},
spinner: {
style: { fill: { color: '#00a4e1', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }, stroke: '#00a4e1' },
innerRadius: '45%', // specifies the inner Radius of the dial
outerRadius: '60%', // specifies the outer Radius of the dial
marks: {
colorRemaining: '#fff',
colorProgress: '#fff',
type: 'line',
offset: '46%',
thickness: 2,
size: '14%',
majorSize: '14%',
majorInterval: 10,
minorInterval: 10
},
},
dial:
{
style: { fill: { color: '#dfe3e9', gradientType: "linearHorizontal", gradientStops: [[0, 0.9], [50, 1], [100, 1]] }, stroke: '#dfe3e9' },
innerRadius: '0%', // specifies the inner Radius of the dial
outerRadius: '45%'
},
pointer:
{
type: 'circle',
style: { fill: '#ef6100', stroke: '#ef6100' },
size: '5%',
offset: '38%',
thickness: 20
}
});
var lastValue;
var newValue = 0;
var min = 0;
var max = 255;
$('#knob').on('change', function (event) {
lastValue = newValue;
newValue = event.args.value;
if (newValue >= min && newValue <= min + 10 && lastValue <= max && lastValue >= max - 10){
min = max;
max += 100;
$('#knob').jqxKnob({ value: max, max: max, min: min });
} else if (newValue >= max - 10 && newValue <= max && lastValue >= min && lastValue <= min + 10){
max = min;
min -= 100;
$('#knob').jqxKnob({ value: min, min: min, max: max });
}
document.getElementById("sp1").innerHTML=newValue;
});
});
</script>
<body class='default'>
<div id='knob'>
</div>
<p>
值:<span id="sp1"></span>
</body>
</html>
#include<ESP8266WebServer.h>
ESP8266WebServer server(80);
char ssid[]="bsnet-1";
char pass[]="062230542";
int count=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.begin(ssid,pass);
delay(3000);
server.on("/",HTTP_POST,fun1);
server.begin();
Serial.println();
Serial.println(WiFi.localIP());
}
void fun1()
{
String s=server.arg("t1");
int p=s.toInt();
if (p==1)
{
int rv=server.arg("t2").toInt();
Serial.println(rv);
server.send(200,"text/html",(String)rv+"-脈衝值傳送成功");
}
//int rv=random(0,9);
else
{
server.send(200,"text/html","未進行脈衝值傳送成功");
}
}
void loop() {
// put your main code here, to run repeatedly:
server.handleClient();
}
b.工具-開發版管理員 安裝2.3版
NodeMcu1.0(ESP-12Emodule)
速度115200
cpu 80MHz
flash 4m
===============================
測試上網
#include<ESP8266WiFi.h>
#include<ESP8266WebServer.h>
ESP8266WebServer server(80);
char ssid[]="bsnet-1";
char pass[]="062230542";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.begin(ssid,pass);
delay(3000);
server.on("/",fun1);
server.begin();
Serial.println();
Serial.println(WiFi.localIP());
}
void fun1()
{
Serial.println();
server.send(200,"text/html","Hello Webserver");
}
void loop() {
// put your main code here, to run repeatedly:
server.handleClient();
}
+++++++++++++++++++++++++++++++++++++++
ESP8266-12E
c++
======
1205
hmibasic8 hmi UI
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>
<link rel="stylesheet" href="./hmili/jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="./jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="./hmili/jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="./hmili/jqwidgets/jqxdraw.js"></script>
<script type="text/javascript" src="./hmili/jqwidgets/jqxknob.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#knob').jqxKnob({
value: 60,
min: 0,
max: 255,
startAngle: 150,
endAngle: 510,
snapToStep: true,
rotation: 'clockwise',
style: { stroke: '#dfe3e9', strokeWidth: 3, fill: { color: '#fefefe', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] } },
marks: {
colorRemaining: '#333',
colorProgress: '#333',
type: 'line',
offset: '71%',
thickness: 1,
size: '6%',
majorSize: '9%',
majorInterval: 10,
minorInterval: 2
},
labels: {
offset: '88%',
step: 10
},
progressBar: {
style: { fill: { color: '#00a644', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }, stroke: '#00a644' },
background: { fill: { color: '#ff8b1e', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }, stroke: '#ff8b1e' },
size: '9%',
offset: '60%'
},
spinner: {
style: { fill: { color: '#00a4e1', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }, stroke: '#00a4e1' },
innerRadius: '45%', // specifies the inner Radius of the dial
outerRadius: '60%', // specifies the outer Radius of the dial
marks: {
colorRemaining: '#fff',
colorProgress: '#fff',
type: 'line',
offset: '46%',
thickness: 2,
size: '14%',
majorSize: '14%',
majorInterval: 10,
minorInterval: 10
},
},
dial:
{
style: { fill: { color: '#dfe3e9', gradientType: "linearHorizontal", gradientStops: [[0, 0.9], [50, 1], [100, 1]] }, stroke: '#dfe3e9' },
innerRadius: '0%', // specifies the inner Radius of the dial
outerRadius: '45%'
},
pointer:
{
type: 'circle',
style: { fill: '#ef6100', stroke: '#ef6100' },
size: '5%',
offset: '38%',
thickness: 20
}
});
var lastValue;
var newValue = 0;
var min = 0;
var max = 255;
$('#knob').on('change', function (event) {
lastValue = newValue;
newValue = event.args.value;
if (newValue >= min && newValue <= min + 10 && lastValue <= max && lastValue >= max - 10){
min = max;
max += 100;
$('#knob').jqxKnob({ value: max, max: max, min: min });
} else if (newValue >= max - 10 && newValue <= max && lastValue >= min && lastValue <= min + 10){
max = min;
min -= 100;
$('#knob').jqxKnob({ value: min, min: min, max: max });
}
document.getElementById("sp1").innerHTML=newValue;
});
});
</script>
<body class='default'>
<div id='knob'>
</div>
<p>
值:<span id="sp1"></span>
</body>
</html>
==========================
#include<ESP8266WiFi.h>#include<ESP8266WebServer.h>
ESP8266WebServer server(80);
char ssid[]="bsnet-1";
char pass[]="062230542";
int count=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.begin(ssid,pass);
delay(3000);
server.on("/",HTTP_POST,fun1);
server.begin();
Serial.println();
Serial.println(WiFi.localIP());
}
void fun1()
{
String s=server.arg("t1");
int p=s.toInt();
if (p==1)
{
int rv=server.arg("t2").toInt();
Serial.println(rv);
server.send(200,"text/html",(String)rv+"-脈衝值傳送成功");
}
//int rv=random(0,9);
else
{
server.send(200,"text/html","未進行脈衝值傳送成功");
}
}
void loop() {
// put your main code here, to run repeatedly:
server.handleClient();
}
沒有留言:
張貼留言