-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnefry.html
154 lines (150 loc) · 7.88 KB
/
nefry.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>milkcocoa と ESP8266つないでみた</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>milkcocoa と ESP8266つないでみた!</h1>
<table border="1" width="700" cellspacing="0" cellpadding="5" bordercolor="#333333">
<tr><th bgcolor="#EE0000"><font color="#FFFFFF">action ID</font></th>
<th bgcolor="#EE0000" width="150"><font color="#FFFFFF">モード名</font></th>
<th bgcolor="#EE0000" width="200"><font color="#FFFFFF">引数になるもの</font></th>
<th bgcolor="#EE0000" width="200"><font color="#FFFFFF">戻り値になるもの</font></th>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>1</td>
<td bgcolor="#FFFFFF" valign="top" width="150">pinMode</td>
<td bgcolor="#FFFFFF" valign="top" width="200">pin:D0,D1,D2,D3,D4,D5</br>state:OUTPUT (1) INPUT (0)</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>2</td>
<td bgcolor="#FFFFFF" valign="top" width="150">pinPullup</td>
<td bgcolor="#FFFFFF" valign="top" width="200">pin:D0,D1,D2,D3,D4,D5</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>3</td>
<td bgcolor="#FFFFFF" valign="top" width="150">digitalRead</td>
<td bgcolor="#FFFFFF" valign="top" width="200">pin:D0,D1,D2,D3,D4,D5</td>
<td bgcolor="#FFFFFF" valign="top" width="180">HIGH (1) LOW (0)</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>4</td>
<td bgcolor="#FFFFFF" valign="top" width="150">digitalWrite</td>
<td bgcolor="#FFFFFF" valign="top" width="200">pin:D0,D1,D2,D3,D4,D5</br>state:HIGH (1) LOW (0)</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>5</td>
<td bgcolor="#FFFFFF" valign="top" width="150">analogRead(A0)</td>
<td bgcolor="#FFFFFF" valign="top" width="200">なし</td>
<td bgcolor="#FFFFFF" valign="top" width="180">A0のアナログ入力</td>>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>6</td>
<td bgcolor="#FFFFFF" valign="top" width="150">analogWrite</td>
<td bgcolor="#FFFFFF" valign="top" width="200">state:0-255 pin:D2,D3,D4</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>7</td>
<td bgcolor="#FFFFFF" valign="top" width="150">uartMode</td>
<td bgcolor="#FFFFFF" valign="top" width="200">state:9600,14400,19200,28800,38400,57600,115200</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr> <tr>
<td bgcolor="#99CC00" align="right" nowrap>8</td>
<td bgcolor="#FFFFFF" valign="top" width="150">uartWrite</td>
<td bgcolor="#FFFFFF" valign="top" width="200">state:文字</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr> <tr>
<td bgcolor="#99CC00" align="right" nowrap>9</td>
<td bgcolor="#FFFFFF" valign="top" width="150">uratRead</td>
<td bgcolor="#FFFFFF" valign="top" width="200">なし</td>
<td bgcolor="#FFFFFF" valign="top" width="180">文字、文字列</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>10</td>
<td bgcolor="#FFFFFF" valign="top" width="150">reset</td>
<td bgcolor="#FFFFFF" valign="top" width="200">なし</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr>
<tr>
<td bgcolor="#99CC00" align="right" nowrap>11</td>
<td bgcolor="#FFFFFF" valign="top" width="150">sleep</td>
<td bgcolor="#FFFFFF" valign="top" width="200">state:sleepする秒数</td>
<td bgcolor="#FFFFFF" valign="top" width="180">なし</td>
</tr>
</table>
</p>
<datalist id="codeType">
<option value="1" label="pinMode"></option>
<option value="2" label="pinPullup"></option>
<option value="3" label="digitalRead"></option>
<option value="4" label="digitalWrite"></option>
<option value="5" label="analogRead"></option>
<option value="6" label="analogWrite"></option>
<option value="7" label="uartMode"></option>
<option value="8" label="uartWrite"></option>
<option value="9" label="uratRead"></option>
<option value="10" label="reset"></option>
<option value="11" label="sleep"></option>
</datalist>
<form action="nefry.html" method="get">
<p><label>action ID :<input type="number"min="1"max="11"list="codeType" required name="mode_setting" size="3"></label></p>
<p><label>Pin :<input type="number"min="0"max="5" name="pin" size="3"></label></p>
<p><label>State :<input type="text" name="state" size="20"></label></p>
<input type="button" value="送信" onclick="return chk2(this.form)" /><!-- 通常ボタン -->
</form>
<script src="http://cdn.mlkcca.com/v2.0.0/milkcocoa.js"></script>
<script type="text/javascript">
function chk2(frm) {
var milkcocoa = new MilkCocoa('leadii5pbr0b.mlkcca.com');
var mode, pin;
var state;
if (frm.elements["state"].value == "")
state = 0;
else if (frm.elements["state"].value == "HIGH")
state = 1;
else if (frm.elements["state"].value == "LOW")
state = 0;
else if (frm.elements["state"].value == "OUTPUT")
state = 1;
else if (frm.elements["state"].value == "INPUT")
state = 0;
else if (frm.elements["state"].value == "high")
state = 1;
else if (frm.elements["state"].value == "low")
state = 0;
else if (frm.elements["state"].value == "output")
state = 1;
else if (frm.elements["state"].value == "input")
state = 0;
else if (frm.elements["mode_setting"].value == "8")
state = frm.elements["state"].value;
else
state =parseInt(frm.elements["state"].value);
if (frm.elements["pin"].value == "")
pin = 0;
else
pin = frm.elements["pin"].value;
if (frm.elements["mode_setting"].value == "") {
alert("action IDを入力してください");
} else {
/* submitメソッドでフォーム送信 */
alert("送信します!");
var ds = milkcocoa.dataStore('arduino');
ds.push({mode: parseInt(frm.elements["mode_setting"].value), pin: parseInt(pin), state: state});
frm.submit();
}
}
</script>
</body>
</html>