@@ -10,7 +10,7 @@ This fork includes powerful new reactive extensions with comprehensive operator
1010
1111### 🔧 Advanced Operators
1212- ** ` Select() ` ** - Transform values with custom mapping functions
13- - ** ` Distinct() ` ** - Filter out duplicate values from stream
13+ - ** ` Distinct() ` ** - Filter out ALL duplicate values (global uniqueness)
1414- ** ` DistinctUntilChanged() ` ** - Emit only when value changes from previous
1515- ** ` Scan() ` ** - Accumulate values with intermediate emissions
1616- ** ` Reduce() ` ** - Accumulate to final result only
@@ -79,68 +79,20 @@ More examples in Wiki/[Examples](https://github.com/luisllamasbinaburo/Arduino-R
7979### Observable, observers and operators legend
8080More info about the Observables, Observers, and Operators available in the [Wiki](https://github.com/luisllamasbinaburo/Arduino-ReactiveArduino/wiki)
8181
82- ```
83- ┌─────────────────────────────────────────────────────────────────────────────────────┐
84- │ 🔄 REACTIVE ARDUINO COMPONENT LEGEND 🔄 │
85- ├─────────────────────────────────────────────────────────────────────────────────────┤
86- │ │
87- │ 📡 OBSERVABLES (Data Sources) │
88- │ ┌─────────────────────────────────────────────────────────────────────────────┐ │
89- │ │ • FromArray() • FromProperty() • FromSerial() │ │
90- │ │ • FromRange() • AnalogInput() • DigitalInput() │ │
91- │ │ • TimerMillis() • TimerMicros() • IntervalMillis() │ │
92- │ │ • Property<T >() • ManualDefer() • IntervalMicros() │ │
93- │ │ • Accelerometer() • Ultrasonic() • RotaryEncoder() │ │
94- │ └─────────────────────────────────────────────────────────────────────────────┘ │
95- │ ⬇️ │
96- │ 🔧 OPERATORS (Data Processing) │
97- │ ┌─────────────────────────────────────────────────────────────────────────────┐ │
98- │ │ • Where() • Distinct() • DistinctUntilChanged() │ │
99- │ │ • First() • Last() • Skip() / Take() │ │
100- │ │ • SkipWhile() • TakeWhile() • SkipUntil() / TakeUntil() │ │
101- │ │ • Batch() • Repeat() • Loop() │ │
102- │ │ • StartWith() • Throttle() • Debounce() │ │
103- │ └─────────────────────────────────────────────────────────────────────────────┘ │
104- │ ⬇️ │
105- │ 🔄 TRANSFORMATIONS (Data Conversion) │
106- │ ┌─────────────────────────────────────────────────────────────────────────────┐ │
107- │ │ • Select() • Map<T >() • Cast<T >() │ │
108- │ │ • SelectTo<T >() • Scan() • Reduce() │ │
109- │ │ • Scale() • Interpolate() • Limit() / LimitUpper() │ │
110- │ │ • Millis() • Micros() • Timestamp() │ │
111- │ └─────────────────────────────────────────────────────────────────────────────┘ │
112- │ ⬇️ │
113- │ 🌡️ FILTERS (Conditional Processing) │
114- │ ┌─────────────────────────────────────────────────────────────────────────────┐ │
115- │ │ • IsEqual() • IsNotEqual() • IsGreater() / IsLess() │ │
116- │ │ • IsZero() • IsNotZero() • OnRising() / OnFalling() │ │
117- │ │ • DebounceMillis() • LowPass() • HighPass() │ │
118- │ │ • MovingAverage() • Median3/5() • WindowMillis() │ │
119- │ │ • Kalman() • Hysteresis() • PID() │ │
120- │ └─────────────────────────────────────────────────────────────────────────────┘ │
121- │ ⬇️ │
122- │ 📊 AGGREGATES (Statistical Operations) │
123- │ ┌─────────────────────────────────────────────────────────────────────────────┐ │
124- │ │ • Count() • CountDown() • Sum() │ │
125- │ │ • Min() / Max() • Average() • RMS() │ │
126- │ │ • Any() • All() • None() │ │
127- │ └─────────────────────────────────────────────────────────────────────────────┘ │
128- │ ⬇️ │
129- │ 🎯 OBSERVERS (Data Consumers) │
130- │ ┌─────────────────────────────────────────────────────────────────────────────┐ │
131- │ │ • Do() • Finally() • DoAndFinally() │ │
132- │ │ • ToSerial() • ToProperty() • ToArray() │ │
133- │ │ • ToDigitalOutput() • ToAnalogOutput() • ToCircularBuffer() │ │
134- │ │ • DoNothing() • (Custom Actions) │ │
135- │ └─────────────────────────────────────────────────────────────────────────────┘ │
136- │ │
137- │ 💡 USAGE PATTERN: Observable → [ Operators] → [ Transformations] → [ Filters] → │
138- │ [ Aggregates] → Observer │
139- │ │
140- │ Example: FromArray(data, size).Where(condition).Select(transform).ToSerial() │
141- │ │
142- └─────────────────────────────────────────────────────────────────────────────────────┘
143- ```
82+ ## REACTIVE ARDUINO COMPONENT LEGEND
83+
84+ | Component Type | Available Methods |
85+ |----------------|-------------------|
86+ | **OBSERVABLES (Data Sources)** | FromArray(), FromProperty(), FromSerial(), FromRange(), AnalogInput(), DigitalInput(), TimerMillis(), TimerMicros(), IntervalMillis(), Property<T>(), ManualDefer(), IntervalMicros(), Accelerometer(), Ultrasonic(), RotaryEncoder() |
87+ | **OPERATORS (Data Processing)** | Where(), Distinct(), DistinctUntilChanged(), First(), Last(), Skip(), Take(), SkipWhile(), TakeWhile(), SkipUntil(), TakeUntil(), Batch(), Repeat(), Loop(), StartWith(), Throttle(), Debounce() |
88+ | **TRANSFORMATIONS (Data Conversion)** | Select(), Map<T>(), Cast<T>(), SelectTo<T>(), Scan(), Reduce(), Scale(), Interpolate(), Limit(), LimitUpper(), Millis(), Micros(), Timestamp() |
89+ | **FILTERS (Conditional Processing)** | IsEqual(), IsNotEqual(), IsGreater(), IsLess(), IsZero(), IsNotZero(), OnRising(), OnFalling(), DebounceMillis(), LowPass(), HighPass(), MovingAverage(), Median3(), Median5(), WindowMillis(), Kalman(), Hysteresis(), PID() |
90+ | **AGGREGATES (Statistical Operations)** | Count(), CountDown(), Sum(), Min(), Max(), Average(), RMS(), Any(), All(), None() |
91+ | **OBSERVERS (Data Consumers)** | Do(), Finally(), DoAndFinally(), ToSerial(), ToProperty(), ToArray(), ToDigitalOutput(), ToAnalogOutput(), ToCircularBuffer(), DoNothing() |
92+
93+ **Usage Pattern:** Observable → [Operators] → [Transformations] → [Filters] → [Aggregates] → Observer
94+
95+ **Example:** `FromArray(data, size).Where(condition).Select(transform).ToSerial()`
14496
14597### Creating Observables
14698Observables are generally generated through factory methods provided by the Reactive class.
@@ -270,10 +222,17 @@ FromArray(data, 5)
270222
271223#### Distinct Value Filtering
272224``` c++
273- int values[] = {1, 1, 2, 2, 2, 3, 1, 3, 3};
274- FromArray (values, 9)
275- .Distinct() // Outputs: 1, 2, 3, 1, 3 (removes consecutive duplicates)
276- .Do([ ] (int x) { Serial.println(x); });
225+ // Distinct - filters out ALL duplicates ever seen (global uniqueness)
226+ int values1[] = {1, 1, 2, 2, 2, 3, 1, 3, 3};
227+ FromArray (values1, 9)
228+ .Distinct() // Outputs: 1, 2, 3 (only first occurrence of each unique value)
229+ .Do([ ] (int x) { Serial.print("Distinct: "); Serial.println(x); });
230+
231+ // DistinctUntilChanged - filters out consecutive duplicates only
232+ int values2[ ] = {1, 1, 2, 2, 2, 3, 1, 3, 3};
233+ FromArray (values2, 9)
234+ .DistinctUntilChanged() // Outputs: 1, 2, 3, 1, 3 (removes consecutive duplicates)
235+ .Do([ ] (int x) { Serial.print("DistinctUntilChanged: "); Serial.println(x); });
277236```
278237
279238#### Sensor Data Processing with Debouncing
0 commit comments