Commit 6f9c17a2 authored by funshine's avatar funshine
Browse files

add adc module, wifi.sta.getap() api, update doc

parent c49d438c
This diff is collapsed.
# **NodeMcu** # # **NodeMcu** #
###A lua based firmware for wifi-soc esp8266 ###A lua based firmware for wifi-soc esp8266
version 0.9.2 build 2014-11-18 version 0.9.2 build 2014-11-19
# Change log # Change log
[change log](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_en#change_log)<br /> [change log](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_en#change_log)<br />
[变更日志](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_cn#change_log) [变更日志](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_cn#change_log)
......
This diff is collapsed.
# **nodeMcu API说明** # # **nodeMcu API说明** #
[English Version](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_en) [English Version](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_en)
###版本 0.9.2 build 2014-11-18 ###版本 0.9.2 build 2014-11-19
<a id="change_log"></a> <a id="change_log"></a>
###变更日志: ###变更日志:
2014-11-19<br />
增加adc模块,adc.read(0)读取adc的值。<br />
wifi模块增加wifi.sta.getap() 函数,用于获取ap列表。
2014-11-18<br /> 2014-11-18<br />
修正tcp服务器不能使用:close()函数关闭tcp连接的问题。<br /> 修正tcp服务器不能使用:close()函数关闭tcp连接的问题。<br />
tcp服务器: 服务器将关闭30s内未使用的闲置的连接。(修正前为180s)<br /> tcp服务器: 服务器将关闭30s内未使用的闲置的连接。(修正前为180s)<br />
...@@ -807,6 +811,36 @@ mac地址字符串,如:"18-33-44-FE-55-BB" ...@@ -807,6 +811,36 @@ mac地址字符串,如:"18-33-44-FE-55-BB"
####参见 ####参见
**-** [wifi.sta.getip()](#ws_getip) **-** [wifi.sta.getip()](#ws_getip)
<a id="ws_getap"></a>
## wifi.sta.getap()
####描述
扫描并列出ap,结果以一个lua table为参数传递给回调函数。
####语法
wifi.sta.getap(function(table))
####参数
function(table): 当扫描结束时,调用此回调函数<br />
扫描结果是一个lua table,key为ap的ssid,value为其他信息,格式:authmode,rssi,bssid,channel
####返回值
nil
####示例
```lua
-- print ap list
function listap(t)
for k,v in pairs(t) do
print(k.." : "..v)
end
end
wifi.sta.getap(listap)
```
####参见
**-** [wifi.sta.getip()](#ws_getip)
#wifi.ap 子模块 #wifi.ap 子模块
...@@ -1707,4 +1741,25 @@ string:接收到的数据。 ...@@ -1707,4 +1741,25 @@ string:接收到的数据。
``` ```
####参见 ####参见
**-** [i2c.write()](#ic_write) **-** [i2c.write()](#ic_write)
\ No newline at end of file
#adc 模块
##常量
<a id="adc_read"></a>
## adc.read()
####描述
读取adc的值,esp8266只有一个10bit adc,id为0,最大值1024
####语法
adc.read(id)
####参数
id = 0<br />
####返回值
adc 值 10bit,最大1024.
####参见
**-** []()
This diff is collapsed.
# **nodeMcu API Instruction** # # **nodeMcu API Instruction** #
[中文版本](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_cn) [中文版本](https://github.com/funshine/nodemcu-firmware/wiki/nodemcu_api_cn)
###version 0.9.2 build 2014-11-18 ###version 0.9.2 build 2014-11-19
<a id="change_log"></a> <a id="change_log"></a>
###change log: ###change log:
2014-11-19<br />
add adc module, use adc.read(0) to read adc value, no tests made.<br />
add wifi.sta.getap() api to wifi.sta module, to get ap list.
2014-11-18<br /> 2014-11-18<br />
bug fixed: net.socket:connect() has no effect. bug fixed: net.socket:connect() has no effect.
...@@ -824,6 +828,36 @@ mac address in string, for example:"18-33-44-FE-55-BB" ...@@ -824,6 +828,36 @@ mac address in string, for example:"18-33-44-FE-55-BB"
####See also ####See also
**-** [wifi.sta.getip()](#ws_getip) **-** [wifi.sta.getip()](#ws_getip)
<a id="ws_getap"></a>
## wifi.sta.getap()
####Description
scan and get ap list as a lua table into callback function.
####Syntax
wifi.sta.getap(function(table))
####Parameters
function(table): a callback function to receive ap table when scan is done<br />
this function receive a table, the key is the ssid, value is other info in format: authmode,rssi,bssid,channel
####Returns
nil
####Example
```lua
-- print ap list
function listap(t)
for k,v in pairs(t) do
print(k.." : "..v)
end
end
wifi.sta.getap(listap)
```
####See also
**-** [wifi.sta.getip()](#ws_getip)
#wifi.ap module #wifi.ap module
...@@ -1728,3 +1762,23 @@ string:data received. ...@@ -1728,3 +1762,23 @@ string:data received.
####See also ####See also
**-** [i2c.write()](#ic_write) **-** [i2c.write()](#ic_write)
#adc module
##CONSTANT
none
<a id="adc_read"></a>
## adc.read()
####Description
read adc value of id, esp8266 has only one 10bit adc, id=0
####Syntax
adc.read(id)
####Parameters
id = 0<br />
####Returns
adc value
####See also
**-** []()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment