Commit b62fae91 authored by Terry Ellison's avatar Terry Ellison Committed by GitHub
Browse files

Merge pull request #2055 from nodemcu/dev

2.1.0-follow-up master drop
parents c8ac5cfb fee5608c
...@@ -17,7 +17,9 @@ X,Y,Z data (integers) ...@@ -17,7 +17,9 @@ X,Y,Z data (integers)
#### Example #### Example
```lua ```lua
adxl345.init(1, 2) local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
adxl345.setup()
local x,y,z = adxl345.read() local x,y,z = adxl345.read()
print(string.format("X = %d, Y = %d, Z = %d", x, y, z)) print(string.format("X = %d, Y = %d, Z = %d", x, y, z))
``` ```
...@@ -25,6 +27,10 @@ print(string.format("X = %d, Y = %d, Z = %d", x, y, z)) ...@@ -25,6 +27,10 @@ print(string.format("X = %d, Y = %d, Z = %d", x, y, z))
## adxl345.init() ## adxl345.init()
Initializes the module and sets the pin configuration. Initializes the module and sets the pin configuration.
!!! attention
This function is deprecated and will be removed in upcoming releases. Use `adxl345.setup()` instead.
#### Syntax #### Syntax
`adxl345.init(sda, scl)` `adxl345.init(sda, scl)`
...@@ -34,3 +40,15 @@ Initializes the module and sets the pin configuration. ...@@ -34,3 +40,15 @@ Initializes the module and sets the pin configuration.
#### Returns #### Returns
`nil` `nil`
## adxl345.setup()
Initializes the module.
#### Syntax
`adxl345.setup()`
#### Parameters
None
#### Returns
`nil`
...@@ -9,6 +9,10 @@ This module provides access to the [AM2320](https://akizukidenshi.com/download/d ...@@ -9,6 +9,10 @@ This module provides access to the [AM2320](https://akizukidenshi.com/download/d
## am2320.init() ## am2320.init()
Initializes the module and sets the pin configuration. Returns model, version, serial but is seams these where all zero on my model. Initializes the module and sets the pin configuration. Returns model, version, serial but is seams these where all zero on my model.
!!! attention
This function is deprecated and will be removed in upcoming releases. Use `am2320.setup()` instead.
#### Syntax #### Syntax
`model, version, serial = am2320.init(sda, scl)` `model, version, serial = am2320.init(sda, scl)`
...@@ -35,9 +39,26 @@ Samples the sensor and returns the relative humidity in % and temperature in cel ...@@ -35,9 +39,26 @@ Samples the sensor and returns the relative humidity in % and temperature in cel
#### Example #### Example
```lua ```lua
am2320.init(1, 2) sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
am2320.setup()
rh, t = am2320.read() rh, t = am2320.read()
print(string.format("RH: %s%%", rh / 10)) print(string.format("RH: %s%%", rh / 10))
print(string.format("Temperature: %s degrees C", t / 10)) print(string.format("Temperature: %s degrees C", t / 10))
``` ```
## am2320.setup()
Initializes the module. Returns model, version, serial but is seams these where all zero on my model.
#### Syntax
`model, version, serial = am2320.setup()`
#### Parameters
None
#### Returns
- `model` 16 bits number of model
- `version` 8 bits version number
- `serial` 32 bits serial number
Note: I have only observed values of 0 for all of these, maybe other sensors return more sensible readings.
This diff is collapsed.
...@@ -9,6 +9,10 @@ This module provides access to the [BMP085](https://www.sparkfun.com/tutorials/2 ...@@ -9,6 +9,10 @@ This module provides access to the [BMP085](https://www.sparkfun.com/tutorials/2
## bmp085.init() ## bmp085.init()
Initializes the module and sets the pin configuration. Initializes the module and sets the pin configuration.
!!! attention
This function is deprecated and will be removed in upcoming releases. Use `bmp085.setup()` instead.
#### Syntax #### Syntax
`bmp085.init(sda, scl)` `bmp085.init(sda, scl)`
...@@ -19,6 +23,18 @@ Initializes the module and sets the pin configuration. ...@@ -19,6 +23,18 @@ Initializes the module and sets the pin configuration.
#### Returns #### Returns
`nil` `nil`
## bmp085.setup()
Initializes the module.
#### Syntax
`bmp085.setup()`
#### Parameters
None
#### Returns
`nil`
## bmp085.temperature() ## bmp085.temperature()
Samples the sensor and returns the temperature in celsius as an integer multiplied with 10. Samples the sensor and returns the temperature in celsius as an integer multiplied with 10.
...@@ -30,7 +46,9 @@ temperature multiplied with 10 (integer) ...@@ -30,7 +46,9 @@ temperature multiplied with 10 (integer)
#### Example #### Example
```lua ```lua
bmp085.init(1, 2) local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW)
bmp085.setup()
local t = bmp085.temperature() local t = bmp085.temperature()
print(string.format("Temperature: %s.%s degrees C", t / 10, t % 10)) print(string.format("Temperature: %s.%s degrees C", t / 10, t % 10))
``` ```
...@@ -53,7 +71,9 @@ pressure in pascals (integer) ...@@ -53,7 +71,9 @@ pressure in pascals (integer)
#### Example #### Example
```lua ```lua
bmp085.init(1, 2) local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
bmp085.setup()
local p = bmp085.pressure() local p = bmp085.pressure()
print(string.format("Pressure: %s.%s mbar", p / 100, p % 100)) print(string.format("Pressure: %s.%s mbar", p / 100, p % 100))
``` ```
......
...@@ -18,7 +18,9 @@ temperature multiplied with 10 (integer) ...@@ -18,7 +18,9 @@ temperature multiplied with 10 (integer)
#### Example #### Example
```lua ```lua
hmc58831.init(1, 2) local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
hmc5883l.setup()
local x,y,z = hmc5883l.read() local x,y,z = hmc5883l.read()
print(string.format("x = %d, y = %d, z = %d", x, y, z)) print(string.format("x = %d, y = %d, z = %d", x, y, z))
``` ```
...@@ -26,6 +28,10 @@ print(string.format("x = %d, y = %d, z = %d", x, y, z)) ...@@ -26,6 +28,10 @@ print(string.format("x = %d, y = %d, z = %d", x, y, z))
## hmc5883l.init() ## hmc5883l.init()
Initializes the module and sets the pin configuration. Initializes the module and sets the pin configuration.
!!! attention
This function is deprecated and will be removed in upcoming releases. Use `hmc5883l.setup()` instead.
#### Syntax #### Syntax
`hmc5883l.init(sda, scl)` `hmc5883l.init(sda, scl)`
...@@ -35,3 +41,15 @@ Initializes the module and sets the pin configuration. ...@@ -35,3 +41,15 @@ Initializes the module and sets the pin configuration.
#### Returns #### Returns
`nil` `nil`
## hmc5883l.setup()
Initializes the module.
#### Syntax
`hmc5883l.setup()`
#### Parameters
None
#### Returns
`nil`
...@@ -33,7 +33,7 @@ Executes a HTTP DELETE request. Note that concurrent requests are not supported. ...@@ -33,7 +33,7 @@ Executes a HTTP DELETE request. Note that concurrent requests are not supported.
- `url` The URL to fetch, including the `http://` or `https://` prefix - `url` The URL to fetch, including the `http://` or `https://` prefix
- `headers` Optional additional headers to append, *including \r\n*; may be `nil` - `headers` Optional additional headers to append, *including \r\n*; may be `nil`
- `body` The body to post; must already be encoded in the appropriate format, but may be empty - `body` The body to post; must already be encoded in the appropriate format, but may be empty
- `callback` The callback function to be invoked when the response has been received; it is invoked with the arguments `status_code`, `body` and `headers` - `callback` The callback function to be invoked when the response has been received or an error occurred; it is invoked with the arguments `status_code`, `body` and `headers`. In case of an error `status_code` is set to -1.
#### Returns #### Returns
`nil` `nil`
...@@ -62,7 +62,7 @@ Executes a HTTP GET request. Note that concurrent requests are not supported. ...@@ -62,7 +62,7 @@ Executes a HTTP GET request. Note that concurrent requests are not supported.
#### Parameters #### Parameters
- `url` The URL to fetch, including the `http://` or `https://` prefix - `url` The URL to fetch, including the `http://` or `https://` prefix
- `headers` Optional additional headers to append, *including \r\n*; may be `nil` - `headers` Optional additional headers to append, *including \r\n*; may be `nil`
- `callback` The callback function to be invoked when the response has been received; it is invoked with the arguments `status_code`, `body` and `headers` - `callback` The callback function to be invoked when the response has been received or an error occurred; it is invoked with the arguments `status_code`, `body` and `headers`. In case of an error `status_code` is set to -1.
#### Returns #### Returns
`nil` `nil`
...@@ -89,7 +89,7 @@ Executes a HTTP POST request. Note that concurrent requests are not supported. ...@@ -89,7 +89,7 @@ Executes a HTTP POST request. Note that concurrent requests are not supported.
- `url` The URL to fetch, including the `http://` or `https://` prefix - `url` The URL to fetch, including the `http://` or `https://` prefix
- `headers` Optional additional headers to append, *including \r\n*; may be `nil` - `headers` Optional additional headers to append, *including \r\n*; may be `nil`
- `body` The body to post; must already be encoded in the appropriate format, but may be empty - `body` The body to post; must already be encoded in the appropriate format, but may be empty
- `callback` The callback function to be invoked when the response has been received; it is invoked with the arguments `status_code`, `body` and `headers` - `callback` The callback function to be invoked when the response has been received or an error occurred; it is invoked with the arguments `status_code`, `body` and `headers`. In case of an error `status_code` is set to -1.
#### Returns #### Returns
`nil` `nil`
...@@ -119,7 +119,7 @@ Executes a HTTP PUT request. Note that concurrent requests are not supported. ...@@ -119,7 +119,7 @@ Executes a HTTP PUT request. Note that concurrent requests are not supported.
- `url` The URL to fetch, including the `http://` or `https://` prefix - `url` The URL to fetch, including the `http://` or `https://` prefix
- `headers` Optional additional headers to append, *including \r\n*; may be `nil` - `headers` Optional additional headers to append, *including \r\n*; may be `nil`
- `body` The body to post; must already be encoded in the appropriate format, but may be empty - `body` The body to post; must already be encoded in the appropriate format, but may be empty
- `callback` The callback function to be invoked when the response has been received; it is invoked with the arguments `status_code`, `body` and `headers` - `callback` The callback function to be invoked when the response has been received or an error occurred; it is invoked with the arguments `status_code`, `body` and `headers`. In case of an error `status_code` is set to -1.
#### Returns #### Returns
`nil` `nil`
...@@ -150,7 +150,7 @@ Execute a custom HTTP request for any HTTP method. Note that concurrent requests ...@@ -150,7 +150,7 @@ Execute a custom HTTP request for any HTTP method. Note that concurrent requests
- `method` The HTTP method to use, e.g. "GET", "HEAD", "OPTIONS" etc - `method` The HTTP method to use, e.g. "GET", "HEAD", "OPTIONS" etc
- `headers` Optional additional headers to append, *including \r\n*; may be `nil` - `headers` Optional additional headers to append, *including \r\n*; may be `nil`
- `body` The body to post; must already be encoded in the appropriate format, but may be empty - `body` The body to post; must already be encoded in the appropriate format, but may be empty
- `callback` The callback function to be invoked when the response has been received; it is invoked with the arguments `status_code`, `body` and `headers` - `callback` The callback function to be invoked when the response has been received or an error occurred; it is invoked with the arguments `status_code`, `body` and `headers`. In case of an error `status_code` is set to -1.
#### Returns #### Returns
`nil` `nil`
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -111,7 +111,7 @@ wifi.eventmon.register(wifi.eventmon.STA_DISCONNECTED, wifi_disconnect_event) ...@@ -111,7 +111,7 @@ wifi.eventmon.register(wifi.eventmon.STA_DISCONNECTED, wifi_disconnect_event)
print("Connecting to WiFi access point...") print("Connecting to WiFi access point...")
wifi.setmode(wifi.STATION) wifi.setmode(wifi.STATION)
wifi.sta.config({ssid=SSID, pwd=PASSWORD, save=true}) wifi.sta.config({ssid=SSID, pwd=PASSWORD})
-- wifi.sta.connect() not necessary because config() uses auto-connect=true by default -- wifi.sta.connect() not necessary because config() uses auto-connect=true by default
``` ```
......
...@@ -59,6 +59,7 @@ pages: ...@@ -59,6 +59,7 @@ pages:
- 'hx711' : 'en/modules/hx711.md' - 'hx711' : 'en/modules/hx711.md'
- 'i2c' : 'en/modules/i2c.md' - 'i2c' : 'en/modules/i2c.md'
- 'l3g4200d' : 'en/modules/l3g4200d.md' - 'l3g4200d' : 'en/modules/l3g4200d.md'
- 'mcp4725': 'en/modules/mcp4725.md'
- 'mdns': 'en/modules/mdns.md' - 'mdns': 'en/modules/mdns.md'
- 'mqtt': 'en/modules/mqtt.md' - 'mqtt': 'en/modules/mqtt.md'
- 'net': 'en/modules/net.md' - 'net': 'en/modules/net.md'
......
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