rateOfChange Helper¶
-
template<size_t MaxDeps = 8, typename Source>
auto RxESP32::Helpers::Numerical::rateOfChange(Source &source, const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {})¶ Calculate rate of change per second.
Creates a Computed that returns the rate of change (units per second).
- Since
v0.1.0
Signal<float> position(0.0f); auto velocity = rateOfChange(position); // After some time... position.set(10.0f); Serial.println(velocity.get()); // e.g., 2.5 (units per second)Note
Stateful helper. On first call, returns 0.
Warning
Only accepts arithmetic types (integral and floating-point).
See Also¶
Numerical Helpers - Overview