Add small corrections to docs

This commit is contained in:
Marcel Stör 2016-02-24 23:15:28 +01:00
parent 78e9873d33
commit 6e855cb05b
2 changed files with 14 additions and 12 deletions

View File

@ -17,7 +17,7 @@ Initializes the module and sets the pin configuration. Returns model, version, s
- `version` 8 bits version number - `version` 8 bits version number
- `serial` 32 bits serial number - `serial` 32 bits serial number
Note: I have only observerd values of 0 for all of these, maybe other sensors return more sensible readings. Note: I have only observed values of 0 for all of these, maybe other sensors return more sensible readings.
## am2320.read() ## am2320.read()
Samples the sensor and returns the relative humidity in % and temperature in celsius, as an integer multiplied with 10. Samples the sensor and returns the relative humidity in % and temperature in celsius, as an integer multiplied with 10.
@ -35,4 +35,5 @@ am2320.init(1, 2)
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))
```

View File

@ -1,38 +1,39 @@
# mdns Module # mDns Module
Multicast DNS is used as part of Bonjour / Zeroconf. This allows system to identify themselves and the services that they provide on a local area network. Clients are then [Multicast DNS](https://en.wikipedia.org/wiki/Multicast_DNS) is used as part of Bonjour / Zeroconf. This allows system to identify themselves and the services that they provide on a local area network. Clients are then able to discover these systems and connect to them.
able to discover these systems and connect to them.
## mdns.register() ## mdns.register()
Register a hostname and start the mDns service. If the service is already running, then it Register a hostname and start the mDNS service. If the service is already running, then it will be restarted with the new parameters.
will be restarted with the new parameters.
#### Syntax #### Syntax
`mdns.register(hostname, servicename, port [, attributes])` `mdns.register(hostname, servicename, port [, attributes])`
#### Parameters #### Parameters
- `hostname` The hostname for this device. Alphanumeric characters are best. - `hostname` The hostname for this device. Alphanumeric characters are best.
- `servicename` The servicename for this device. Alphanumeric characters are best. This will get prefixed with '_' and suffixed with ._tcp - `servicename` The service name for this device. Alphanumeric characters are best. This will get prefixed with `_` and suffixed with `._tcp`
- `port` The port number for the primary service. - `port` The port number for the primary service.
- `attributes` A optional table of up to 10 attributes to be exposed. The keys must all be strings. - `attributes` A optional table of up to 10 attributes to be exposed. The keys must all be strings.
#### Returns #### Returns
Nothing. `nil`
#### Errors #### Errors
Various errors can be generated during argument validation. The nodemcu must have an IP address at the time of the call, otherwise an error is thrown. Various errors can be generated during argument validation. The NodeMCU must have an IP address at the time of the call, otherwise an error is thrown.
#### Example #### Example
mdns.register("fishtank", "http", 80, { hardware='NodeMCU'}) mdns.register("fishtank", "http", 80, { hardware='NodeMCU'})
Using dns-sd on OSX, you can see fishtank.local as providing the _http._tcp service. You can also browse directly to fishtank.local. In safari you can get all the mdns web pages as part of your bookmarks menu. Using `dns-sd` on OS X, you can see `fishtank.local` as providing the `_http._tcp` service. You can also browse directly to `fishtank.local`. In Safari you can get all the mDNS web pages as part of your bookmarks menu.
## mdns.close() ## mdns.close()
Shut down the mDns service. This is not normally needed. Shut down the mDNS service. This is not normally needed.
#### Syntax #### Syntax
`mdns.close()` `mdns.close()`
#### Parameters
none
#### Returns #### Returns
Nothing. `nil`