-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex_cn.html
614 lines (456 loc) · 19.4 KB
/
index_cn.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
<!DOCTYPE html>
<html lang="en">
<head>
<!--[if lt IE 9]>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="vendor/bower/html5shiv/dist/html5shiv.js"></script>
<![endif]-->
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/ribbon.css">
<link rel="stylesheet" href="resource/mystyle.css" />
<script type="text/javascript" src="resource/prettify.js"></script>
<script type="text/javascript" src="resource/lang-lua.js"></script>
<title>NodeMcu -- 像Arduino一样简单的开源可编程固件,还有Wifi哦!</title>
<script type="text/javascript" src="vendor/bower/jquery/jquery.js"></script>
<script type="text/javascript" src="js/backend/jquery-extends/live-patch.js"></script>
<script type="text/javascript">
var fonts = {
"Open Sans": {
"family": "Open Sans",
"source": "google",
"subsets": [
"cyrillic",
"cyrillic-ext",
"greek",
"greek-ext",
"latin",
"latin-ext",
"vietnamese"
],
"variants": [
"300",
"300italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"italic",
"regular"
]
},
"Oxygen": {
"family": "Oxygen",
"source": "google",
"subsets": [
"latin",
"latin-ext"
],
"variants": [
"300",
"700",
"regular"
]
}
};
</script>
<script type="text/javascript" src="vendor/js/webfont_cn.js"></script>
<script type="text/javascript" src="js/fontloader.js"></script>
<meta http-equiv="content-language" content="en">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta name="keywords" content="nodemcu,wifi-soc,esp8266" />
<meta name="description" content="NodeMcu -- a firmware based on ESP8266 wifi-soc." />
</head>
<body onload="prettyPrint()">
<div class="b-content">
<div id="fr_54747f3dd775ef1a360001a2" class="fr-widget fr-container fr_murose ">
<div id="fr_54747f65d775ef1a360001a6" class="fr-widget fr-grid fr_jagefe ">
<a id="fr_547774ea7976d87281000029" class="fr-widget fr-text fr-wf fr_hometopbutton fr-link fr-widget-hover-opacity-60" href="#fr_54745c8bd775ef4b99000011">
<div class="fr-text">首 页</div>
</a><!--
--><a id="fr_547774e07976d87281000024" class="fr-widget fr-text fr-wf fr_featurestopbutton fr-link fr-widget-hover-opacity-60" href="#fr_54747361d775ef1a3600000f">
<div class="fr-text">特 点</div>
</a><!--
--><a id="fr_547774d67976d8728100001f" class="fr-widget fr-text fr-wf fr_examplestopbutton fr-link fr-widget-hover-opacity-60" href="#fr_5475f7667976d8501100000f">
<div class="fr-text">示 例</div>
</a><!--
--><a id="fr_54775ef27976d8728100000f" class="fr-widget fr-text fr-wf fr_devkittopbutton fr-link fr-widget-hover-opacity-60" href="#fr_54747661d775ef1a3600009e">
<div class="fr-text">开发板</div>
</a><!--
--><a id="fr_549033f3f6fa847bcb00010a" class="fr-widget fr-text fr-wf fr_langtopbutton fr-link fr-widget-hover-opacity-60" href="index_en.html">
<div class="fr-text">English</div>
</a>
</div>
<div class="ribbon">
<a href="https://github.com/nodemcu/nodemcu-firmware">Fork me on GitHub</a>
</div>
</div><!--
--><div id="fr_54745c8bd775ef4b99000011" class="fr-widget fr-container fr_fixed_header ">
<div id="fr_54747d26d775ef1a3600019d" class="fr-widget fr-img fr_duhofu ">
<img src="images/thumbnail/nodemcu-style5-150px.png_150x150.png" />
</div><!--
--><div id="fr_54745c8bd775ef4b99000014" class="fr-widget fr-container fr_container_5 ">
<div id="fr_54745c8bd775ef4b9900001b" class="fr-widget fr-container fr_text_block_center_2 ">
<div id="fr_54745c8bd775ef4b99000055" class="fr-widget fr-text fr-wf fr_header_center_3 fr_h1 ">
<div class="fr-text">
<div>NodeMcu</div>超简单的物联网开发平台</div>
</div><!--
--><div id="fr_54745c8bd775ef4b99000053" class="fr-widget fr-text fr-wf fr_paragraph_center_2 ">
<div class="fr-text">
一款开源快速硬件原型平台,包括固件和开发板,用几行简单的Lua脚本就能开发物联网应用
</div>
</div>
</div>
</div>
<script>
(function() {
'use strict';
var $that = $(this);
$(window).on(
'scroll',
function() {
$that.css('top', -window.scrollY * 0.2 + 'px');
}
);
}).call(document.getElementsByClassName('fr_fixed_header')[0]);
</script>
</div><!--
--><div id="fr_54747361d775ef1a3600000f" class="fr-widget fr-container fr_features ">
<div id="fr_54747361d775ef1a3600001e" class="fr-widget fr-text fr-wf fr_featurestitle ">
<div class="fr-text">特点</div>
</div><!--
--><div id="fr_54747361d775ef1a3600001a" class="fr-widget fr-text fr-wf fr_featuresslogan ">
<div class="fr-text">开源,交互式,可编程,低成本,简单,智能,WI-FI硬件</div>
</div><!--
--><div id="fr_54747361d775ef1a36000013" class="fr-widget fr-grid fr_featuresgrid ">
<div id="fr_54747361d775ef1a3600002a" class="fr-widget fr-container fr_chip ">
<div id="fr_54747362d775ef1a36000084" class="fr-widget fr-img fr_chipimage ">
<img src="images/thumbnail/chips.png_200x200.png" />
</div><!--
--><div id="fr_54923c897af6d40d56000010" class="fr-widget fr-text fr-wf fr_textchipslogan ">
<div class="fr-text">像Arduino一样操作硬件IO</div>
</div><!--
--><div id="fr_54747362d775ef1a3600007c" class="fr-widget fr-text fr-wf fr_textchip ">
<div class="fr-text">提供硬件的高级接口,可以将应用开发者从繁复的硬件配置、寄存器操作中解放出来。用交互式Lua脚本,像arduino一样编写硬件代码!</div>
</div>
</div><!--
--><div id="fr_54747361d775ef1a36000026" class="fr-widget fr-container fr_node ">
<div id="fr_54747362d775ef1a36000060" class="fr-widget fr-img fr_nodeimage ">
<img src="images/thumbnail/node1s_1.png_200x200.png" />
</div><!--
--><div id="fr_54923cd67af6d40d56000014" class="fr-widget fr-text fr-wf fr_textnodeslogan ">
<div class="fr-text">用Nodejs类似语法写网络应用</div>
</div><!--
--><div id="fr_54747362d775ef1a36000058" class="fr-widget fr-text fr-wf fr_textnode ">
<div class="fr-text">事件驱动型API极大的方便了用户进行网络应用开发,使用类似Nodejs的方式编写网络代码,并运行于5mm*5mm大小的MCU之上,加快您的物联网开发进度。</div>
</div>
</div><!--
--><div id="fr_54747361d775ef1a36000022" class="fr-widget fr-container fr_cloud ">
<div id="fr_54747361d775ef1a3600003c" class="fr-widget fr-img fr_cloudimage ">
<img src="images/thumbnail/clouds.png_200x200.png" />
</div><!--
--><div id="fr_54923ce97af6d40d56000018" class="fr-widget fr-text fr-wf fr_textcloudslogan ">
<div class="fr-text">超低成本的WI-FI模块</div>
</div><!--
--><div id="fr_54747361d775ef1a36000034" class="fr-widget fr-text fr-wf fr_textcloud ">
<div class="fr-text">用于快速原型的开发板,集成了售价低于10人民币WIFI芯片ESP8266。我们为您提供性价比最高的物联网应用开发平台。</div>
</div>
</div>
</div>
</div><!--
--><div id="fr_54760baa7976d83acd000013" class="fr-widget fr-container fr_pudale ">
</div><!--
--><div id="fr_54747661d775ef1a3600009e" class="fr-widget fr-container fr_dev_kit ">
<div id="fr_54747661d775ef1a360000a8" class="fr-widget fr-text fr-wf fr_devkittitle ">
<div class="fr-text">开发板</div>
</div><!--
--><div id="fr_547629d27976d849b9000011" class="fr-widget fr-text fr-wf fr_devkitslogan ">
<div class="fr-text">基于乐鑫esp8266的NodeMcu开发板,具有GPIO、PWM、I2C、1-Wire、ADC等功能,结合NodeMcu 固件为您的原型开发提供最快速的途径。</div>
</div><!--
--><div id="fr_5476109a7976d83acd000017" class="fr-widget fr-img fr_devkitimage ">
<img src="images/thumbnail/zms.jpg_1200x1200.jpg" />
</div><!--
--><div id="fr_54747661d775ef1a360000a2" class="fr-widget fr-grid fr_devkit3columngrid ">
<div id="fr_54747661d775ef1a360000b4" class="fr-widget fr-container fr_pic1 ">
<div id="fr_54747662d775ef1a360000e4" class="fr-widget fr-img fr_devkitpic ">
<img src="images/thumbnail/z1s_1.jpg_450x300.jpg" />
</div><!--
--><div id="fr_54747662d775ef1a360000d8" class="fr-widget fr-text fr-wf fr_pic1dis ">
<div class="fr-text">包含usb串口,即插即用</div>
</div>
</div><!--
--><div id="fr_54747661d775ef1a360000b0" class="fr-widget fr-container fr_pic2 ">
<div id="fr_54747661d775ef1a360000d4" class="fr-widget fr-img fr_devkitpic_2 ">
<img src="images/thumbnail/b1s.jpg_450x300.jpg" />
</div><!--
--><div id="fr_54747661d775ef1a360000c8" class="fr-widget fr-text fr-wf fr_pic2dis ">
<div class="fr-text">10 GPIO, 每个都能配置为 PWM, I2C, 1-wire</div>
</div>
</div><!--
--><div id="fr_54747661d775ef1a360000ac" class="fr-widget fr-container fr_pic3 ">
<div id="fr_54747661d775ef1a360000c4" class="fr-widget fr-img fr_devkitpic_3 ">
<img src="images/thumbnail/c1s.jpg_450x300.jpg" />
</div><!--
--><div id="fr_54747661d775ef1a360000b8" class="fr-widget fr-text fr-wf fr_pic3dis ">
<div class="fr-text">FCC 认证的WI-FI模块,内置PCB天线</div>
</div>
</div>
</div>
</div><!--
--><div id="fr_547479c8d775ef1a36000108" class="fr-widget fr-container fr_pukolo ">
</div><!--
--><div id="fr_5475f7667976d8501100000f" class="fr-widget fr-container fr_examples ">
<div id="fr_5475f7667976d8501100001e" class="fr-widget fr-text fr-wf fr_examplestitle ">
<div class="fr-text">示例</div>
</div><!--
--><div id="fr_5475f7667976d8501100001a" class="fr-widget fr-text fr-wf fr_examplesslogan ">
<div class="fr-text">拿到开发板了?我们开始吧</div>
</div><!--
--><div id="fr_548f020bf6fa84489e000055" class="fr-widget fr-grid fr_examplesgrid ">
<div id="fr_548f0368f6fa84489e00006b" class="fr-widget fr-text fr-wf fr_paragraph_center_3 ">
<div class="fr-text">
<p>连接到路由器</p>
<pre class="prettyprint">
<code class="language-lua">
print(wifi.sta.getip())
--nil
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
print(wifi.sta.getip())
--192.168.18.110
</code>
</pre>
</div>
</div><!--
--><div id="fr_548f038ff6fa84489e000070" class="fr-widget fr-text fr-wf fr_paragraph_center_4 ">
<div class="fr-text">
<p>像Arduino一样操作IO</p>
<pre class="prettyprint">
<code class="language-lua">
pin = 1
gpio.mode(pin,gpio.OUTPUT)
gpio.write(pin,gpio.HIGH)
gpio.mode(pin,gpio.INPUT)
print(gpio.read(pin))
</code>
</pre>
</div>
</div><!--
--><div id="fr_548f039bf6fa84489e000075" class="fr-widget fr-text fr-wf fr_paragraph_center_5 ">
<div class="fr-text">
<p>简单的HTTP客户端</p>
<pre class="prettyprint">
<code class="language-lua">
-- A simple http client
conn=net.createConnection(net.TCP, false)
conn:on("receive", function(conn, pl) print(pl) end)
conn:connect(80,"121.41.33.127")
conn:send("GET / HTTP/1.1\r\nHost: www.nodemcu.com\r\n"
.."Connection: keep-alive\r\nAccept: */*\r\n\r\n")
</code>
</pre>
</div>
</div><!--
--><div id="fr_548f03a6f6fa84489e00007a" class="fr-widget fr-text fr-wf fr_paragraph_center_6 ">
<div class="fr-text">
<p>更简单的HTTP服务器</p>
<pre class="prettyprint">
<code class="language-lua">
-- a simple http server
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("<h1> Hello, NodeMcu.</h1>")
end)
end)
</code>
</pre>
</div>
</div><!--
--><div id="fr_54900805f6fa847bcb00002b" class="fr-widget fr-text fr-wf fr_paragraph_center_7 ">
<div class="fr-text">
<p>PWM操作</p>
<pre class="prettyprint">
<code class="language-lua">
function led(r,g,b)
pwm.setduty(1,r)
pwm.setduty(2,g)
pwm.setduty(3,b)
end
pwm.setup(1,500,512)
pwm.setup(2,500,512)
pwm.setup(3,500,512)
pwm.start(1)
pwm.start(2)
pwm.start(3)
led(512,0,0) -- red
led(0,0,512) -- blue
</code>
</pre>
</div>
</div><!--
--><div id="fr_5490082df6fa847bcb00003d" class="fr-widget fr-text fr-wf fr_paragraph_center_8 ">
<div class="fr-text">
<p>闪烁LED</p>
<pre class="prettyprint">
<code class="language-lua">
lighton=0
tmr.alarm(0,1000,1,function()
if lighton==0 then
lighton=1
led(512,512,512)
-- 512/1024, 50% duty cycle
else
lighton=0
led(0,0,0)
end
end)
</code>
</pre>
</div>
</div><!--
--><div id="fr_54900834f6fa847bcb000042" class="fr-widget fr-text fr-wf fr_paragraph_center_9 ">
<div class="fr-text">
<p>启动文件</p>
<pre class="prettyprint">
<code class="language-lua">
--init.lua will be excuted
file.open("init.lua","w")
file.writeline([[print("Hello World!")]])
file.close()
node.restart() -- this will restart the module.
</code>
</pre>
</div>
</div><!--
--><div id="fr_54900837f6fa847bcb000047" class="fr-widget fr-text fr-wf fr_paragraph_center_10 ">
<div class="fr-text">
<p>用定时器来循环执行</p>
<pre class="prettyprint">
<code class="language-lua">
tmr.alarm(1,5000,1,function() print("alarm 1") end)
tmr.alarm(0,1000,1,function() print("alarm 0") end)
tmr.alarm(2,2000,1,function() print("alarm 2") end)
-- after sometime
tmr.stop(0)
</code>
</pre>
</div>
</div><!--
--><div id="fr_54900e2bf6fa847bcb00004c" class="fr-widget fr-text fr-wf fr_paragraph_center_11 ">
<div class="fr-text">
<p>纯Lua写的telnet服务器</p>
<pre class="prettyprint">
<code class="language-lua">
-- a simple telnet server
s=net.createServer(net.TCP,180)
s:listen(2323,function(c)
function s_output(str)
if(c~=nil)
then c:send(str)
end
end
node.output(s_output, 0)
-- re-direct output to function s_ouput.
c:on("receive",function(c,l)
node.input(l)
--like pcall(loadstring(l)), support multiple separate lines
end)
c:on("disconnection",function(c)
node.output(nil)
--unregist redirect output function, output goes to serial
end)
print("Welcome to NodeMcu world.")
end)
</code>
</pre>
</div>
</div><!--
--><div id="fr_54900e2ff6fa847bcb000051" class="fr-widget fr-text fr-wf fr_paragraph_center_12 ">
<div class="fr-text">
<p>与传感器接口</p>
<pre class="prettyprint">
<code class="language-lua">
-- read temperature with DS18B20
t=require("ds18b20")
t.setup(9)
addrs=t.addrs()
-- Total DS18B20 numbers, assume it is 2
print(table.getn(addrs))
-- The first DS18B20
print(t.read(addrs[1],t.C))
print(t.read(addrs[1],t.F))
print(t.read(addrs[1],t.K))
-- The second DS18B20
print(t.read(addrs[2],t.C))
print(t.read(addrs[2],t.F))
print(t.read(addrs[2],t.K))
-- Just read
print(t.read())
-- Just read as centigrade
print(t.read(nil,t.C))
-- Don't forget to release it after use
t = nil
ds18b20 = nil
package.loaded["ds18b20"]=nil
</code>
</pre>
</div>
</div>
</div>
</div><!--
--><div id="fr_54760b777976d83acd00000f" class="fr-widget fr-container fr_tavoro ">
</div><!--
--><div id="fr_54747a88d775ef1a36000110" class="fr-widget fr-grid fr_cawase ">
<div id="fr_54747a9dd775ef1a3600016a" class="fr-widget fr-container fr_bugefe ">
<div id="fr_54747a9dd775ef1a36000172" class="fr-widget fr-grid fr_gowogu ">
<div id="fr_54747a9dd775ef1a36000188" class="fr-widget fr-container fr_kowafu ">
</div><!--
--><div id="fr_54747a9dd775ef1a3600017c" class="fr-widget fr-text fr-wf fr_contactustext ">
<div class="fr-text">联系我们</div>
</div><!--
--><div id="fr_54747a9dd775ef1a36000180" class="fr-widget fr-container fr_empty2 ">
</div><!--
--><div id="fr_547786c77976d87281000038" class="fr-widget fr-container fr_nodemcuteam ">
<div class="fr-widget fr-text fr-wf nodemcu-team-copyright">
<p>
© 2014-2018 NodeMcu Team
</p>
</div>
</div><!--
--><div id="fr_54747a9dd775ef1a36000184" class="fr-widget fr-container fr_email ">
<a id="fr_549242fe7af6d438a800001d" class="fr-widget fr-text fr-wf fr_emailbutton fr-link" href="mailto:[email protected]">
<div class="fr-text">[email protected]</div>
</a>
</div><!--
--><div id="fr_547786d07976d8728100003c" class="fr-widget fr-container fr_websiteicp ">
<div class="fr-widget fr-text fr-wf website-icp">
<a href="https://beian.miit.gov.cn/" target="_blank">浙ICP备14038071号-1 </a>
</div>
<div class="fr-widget fr-text fr-wf website-icp">
<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=33011002011205" style="display:inline-block;text-decoration:none;height:20px;line-height:20px;">
<img src="beiantubiao.png" style="float:left;"/>
<p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">浙公网安备 33011002011205号</p>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer-assets">
<!--[if lt IE 9]>
<script type="text/javascript" src="vendor/bower/respond/respond.src.js"></script>
<script type="text/javascript" src="vendor/bower/raphael/raphael.js"></script>
<script type="text/javascript" src="vendor/bower/raphael-svg-import-classic/raphael-svg-import.js"></script>
<script type="text/javascript" src="js/raphaelize.js"></script>
<![endif]-->
</div>
</body>
</html>