Update Tutorials.md

This commit is contained in:
HomeSpan 2020-11-22 22:06:47 -06:00 committed by GitHub
parent 79c143e1ec
commit 31d383a62c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -25,6 +25,7 @@ Example 4 expands on Example 3 by adding Characteristics to set fan speed, fan r
Example 5 expands on Example 2 by adding in the code needed to actually control LEDs connected to the ESP32 from HomeKit. In Example 2 we built out all the functionality to create a "Tile" Acessories inside HomeKit that displayed an on/off light, but these control did not actually operate anything on the ESP32. To operate actual devices HomeSpan needs to be programmed to respond to "update" requests from HomeKit by performing some form of operation. New HomeSpan API topics covered in this example include: Example 5 expands on Example 2 by adding in the code needed to actually control LEDs connected to the ESP32 from HomeKit. In Example 2 we built out all the functionality to create a "Tile" Acessories inside HomeKit that displayed an on/off light, but these control did not actually operate anything on the ESP32. To operate actual devices HomeSpan needs to be programmed to respond to "update" requests from HomeKit by performing some form of operation. New HomeSpan API topics covered in this example include:
* creating derived device-specific Service structures (classes) from a base HomeSpan Service class * creating derived device-specific Service structures (classes) from a base HomeSpan Service class
* placing derived Service classes in their own \*.h files for readability and portability
* implementing the virtual `update()` method for your derived Services * implementing the virtual `update()` method for your derived Services
* saving references to Characteristic objects with a `SpanCharacteristic *` pointer * saving references to Characteristic objects with a `SpanCharacteristic *` pointer
* retrieving new and updated Characteristic values with the `getVal()` and `getNewVal()` methods * retrieving new and updated Characteristic values with the `getVal()` and `getNewVal()` methods
@ -34,7 +35,9 @@ Example 6 changes Example 5 so that LED #2 is now dimmable, instead of just on/o
* implementing pulse-width-modulation on any ESP32 pin by instantiating a `PwmPin()` object * implementing pulse-width-modulation on any ESP32 pin by instantiating a `PwmPin()` object
* setting the PWM level to control the brightness of an LED using the PwmPin `set()` method * setting the PWM level to control the brightness of an LED using the PwmPin `set()` method
* storing similar derived Service classes in the same \*.h file for ease of use
### [Example 7 - IdentifyRoutines](../examples/07-IdentifyRoutines/07-IdentifyRoutines.ino)