From c2b411698950efa392ea19e7b3fffa6250720188 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Fri, 27 Nov 2020 19:35:43 -0600 Subject: [PATCH 1/6] Update Extras.md --- docs/Extras.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/Extras.md b/docs/Extras.md index 91e611f..565cc0d 100644 --- a/docs/Extras.md +++ b/docs/Extras.md @@ -58,12 +58,10 @@ Since most RF/IR signals repeat the same train of pulses more than once, the dur * appends a new pulse to the pulse train memory buffer, which has room to store a maximum of 511 high/low pulses. Requests to add more than 511 pulses are ignores but raise a non-fatal warning message. Note that this is a class-level methodβ€”there is only one pulse train memory buffer that is **shared** across all instances of an RFControl object - * *onTime* - the duration, in *ticks* of the high portion of the pulse. Allowable range is 0-32767 ticks. Requests to add a pulse with an *onTime* of greater than 32767 ticks are ignored but raise non-fatal warning message + * *onTime* - the duration, in *ticks* of the high portion of the pulse. Allowable range is 1-32767 ticks. Requests to add a pulse with an *onTime* outside this range are ignored but raise non-fatal warning message - * *offTime* - the duration, in *ticks* of the low portion of the pulse. Allowable range is 0-32767 ticks. Requests to add a pulse with an *offTime* of greater than 32767 ticks are ignored but raise non-fatal warning message - - * note that a pulse with either *onTime=0* or *offTime=0* is permitted, but both **cannot** be zero as this is used by the ESP32 to indicate the end of the pulse train - + * *offTime* - the duration, in *ticks* of the low portion of the pulse. Allowable range is 1-32767 ticks. Requests to add a pulse with an *offTime* outside this range are ignored but raise non-fatal warning message + * `static void clear()` * clears the pulse train memory buffer @@ -74,7 +72,7 @@ Since most RF/IR signals repeat the same train of pulses more than once, the dur * *numCycles* - the total number of times to transmit the pulse train (i.e. a value of 3 means the pulse train will be transmitted once, followed by 2 additional re-transmissions) - * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional arugment with a default of 1 microseconds if not specified. + * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1 microseconds if not specified. Valid range is 0-255, where 0 implies 256 microsends --- From 4700f8705c644ca54655b127bb1b0068bd3c1414 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Fri, 27 Nov 2020 19:48:06 -0600 Subject: [PATCH 2/6] Update Extras.md --- docs/Extras.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/Extras.md b/docs/Extras.md index 565cc0d..711b82a 100644 --- a/docs/Extras.md +++ b/docs/Extras.md @@ -72,7 +72,10 @@ Since most RF/IR signals repeat the same train of pulses more than once, the dur * *numCycles* - the total number of times to transmit the pulse train (i.e. a value of 3 means the pulse train will be transmitted once, followed by 2 additional re-transmissions) - * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1 microseconds if not specified. Valid range is 0-255, where 0 implies 256 microsends + * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1 microseconds if not specified. Valid range is 1-255 microseconds, or 0 for 256 microseconds + +Below is a complete example that produces two different pulse trains with the signal output linked to the ESP32 devices built-in LED. The tick duration is set to a very long 100𝛍s, and pulse times of 1000-10,000 ticks are used, so that the individual pulses range from 100ms to 1s and are visible. In practice the default tick duration of 1𝛍s with pulse durations on the order of 100 ticks would be used to drive an actual RF or IR transmitter. + --- From bffc0629cf65c06fef0bae2277a80f30678b6748 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Fri, 27 Nov 2020 19:53:29 -0600 Subject: [PATCH 3/6] Update Extras.md --- docs/Extras.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/docs/Extras.md b/docs/Extras.md index 711b82a..f191fa3 100644 --- a/docs/Extras.md +++ b/docs/Extras.md @@ -74,9 +74,59 @@ Since most RF/IR signals repeat the same train of pulses more than once, the dur * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1 microseconds if not specified. Valid range is 1-255 microseconds, or 0 for 256 microseconds -Below is a complete example that produces two different pulse trains with the signal output linked to the ESP32 devices built-in LED. The tick duration is set to a very long 100𝛍s, and pulse times of 1000-10,000 ticks are used, so that the individual pulses range from 100ms to 1s and are visible. In practice the default tick duration of 1𝛍s with pulse durations on the order of 100 ticks would be used to drive an actual RF or IR transmitter. +Below is a complete example that produces two different pulse trains with the signal output linked to the ESP32 device's built-in LED. For illustrative purposes tick duration is set to a very long 100𝛍s and pulse times range from of 1000-10,000 ticks so that the individual pulses are easily discernable on the LED. +```C++ +/* HomeSpan RF Transmitter Example */ + +#include "HomeSpan.h" // include the HomeSpan library +#include "extras/RFControl.h" // include RF Control Library + +void setup() { + Serial.begin(115200); // start the Serial interface + Serial.flush(); + delay(1000); // wait for interface to flush + + Serial.print("\n\nHomeSpan RF Transmitter Example\n\n"); + + RFControl rf(LED_BUILTIN); // create an instance of RFControl with signal output to the ESP32's Built-In LED + + rf.clear(); // clear the pulse train memory buffer + + rf.add(5000,5000); // create a pulse train with three 5000-tick high/low pulses + rf.add(5000,5000); + rf.add(5000,10000); // double duration of final low period + + Serial.print("Starting 4 cycles of three 500 ms on pulses..."); + + rf.start(4,100); // start transmission of 4 cycles of the pulse train with 1 tick=100 microseconds + + Serial.print("Done!\n"); + + delay(2000); + + rf.clear(); + + for(int i=1000;i<10000;i+=1000) + rf.add(i,10000-i); + rf.add(10000,10000); + + Serial.print("Starting 3 cycles of 100-1000 ms pulses..."); + + rf.start(3,100); // start transmission of 3 cycles of the pulse train with 1 tick=100 microseconds + + Serial.print("Done!\n"); + + Serial.print("\nEnd Example"); + +} // end of setup() + +void loop(){ + +} // end of loop() +``` + --- [↩️](README.md) Back to the Welcome page From a96ed068544a077d1577d41f5f10a1b97857be60 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Fri, 27 Nov 2020 19:56:26 -0600 Subject: [PATCH 4/6] Update Extras.md --- docs/Extras.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Extras.md b/docs/Extras.md index f191fa3..d30c26b 100644 --- a/docs/Extras.md +++ b/docs/Extras.md @@ -72,9 +72,9 @@ Since most RF/IR signals repeat the same train of pulses more than once, the dur * *numCycles* - the total number of times to transmit the pulse train (i.e. a value of 3 means the pulse train will be transmitted once, followed by 2 additional re-transmissions) - * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1 microseconds if not specified. Valid range is 1-255 microseconds, or 0 for 256 microseconds + * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1𝛍s if not specified. Valid range is 1-255𝛍s, or 0 for 256𝛍s -Below is a complete example that produces two different pulse trains with the signal output linked to the ESP32 device's built-in LED. For illustrative purposes tick duration is set to a very long 100𝛍s and pulse times range from of 1000-10,000 ticks so that the individual pulses are easily discernable on the LED. +Below is a complete example that produces two different pulse trains with the signal output linked to the ESP32 device's built-in LED. For illustrative purposes the tick duration has been set to a very long 100𝛍s, and pulse times range from of 1000-10,000 ticks, so that the individual pulses are easily discernable on the LED. ```C++ /* HomeSpan RF Transmitter Example */ From 93f44036e046e17f5b5ddc316f69a01bb37072d2 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Fri, 27 Nov 2020 19:57:09 -0600 Subject: [PATCH 5/6] Update Extras.md --- docs/Extras.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Extras.md b/docs/Extras.md index d30c26b..16f30a2 100644 --- a/docs/Extras.md +++ b/docs/Extras.md @@ -72,7 +72,7 @@ Since most RF/IR signals repeat the same train of pulses more than once, the dur * *numCycles* - the total number of times to transmit the pulse train (i.e. a value of 3 means the pulse train will be transmitted once, followed by 2 additional re-transmissions) - * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1𝛍s if not specified. Valid range is 1-255𝛍s, or 0 for 256𝛍s + * *tickTime* - the duration, in **microseconds**, of a *tick*. This is an optional argument with a default of 1𝛍s if not specified. Valid range is 1-255𝛍s, or set to 0 for 256𝛍s Below is a complete example that produces two different pulse trains with the signal output linked to the ESP32 device's built-in LED. For illustrative purposes the tick duration has been set to a very long 100𝛍s, and pulse times range from of 1000-10,000 ticks, so that the individual pulses are easily discernable on the LED. From ac9267fd90e0df73037d1656695801c2120a7838 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Fri, 27 Nov 2020 19:58:39 -0600 Subject: [PATCH 6/6] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index c646fb6..63f0cda 100644 --- a/docs/README.md +++ b/docs/README.md @@ -55,7 +55,7 @@ HomeSpan includes the following documentation: * [HomeSpan Command-Line Interface (CLI)](CLI.md) - configure a HomeSpan device's WiFi Credentials, modify its HomeKit Setup Code, monitor and update its status, and access detailed, real-time device diagnostics from the Arduino IDE Serial Monitor * [HomeSpan User Guide](UserGuide.md) - turnkey instructions on how to configure an already-programmed HomeSpan device's WiFi Credentials, modify its HomeKit Setup Code, and pair the device to HomeKit. No computer needed! * [HomeSpan API Reference](Reference.md) - a complete guide to the HomeSpan Library API -* [HomeSpan Extras](Extras.md) - integrated access to the ESP32's on-chip PWM and Remote Control peripherals! :construction: +* [HomeSpan Extras](Extras.md) - integrated access to the ESP32's on-chip PWM and Remote Control peripherals! # External Resources