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))
``` ```
......
This diff is collapsed.
This diff is collapsed.
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