en-us_commands:edge_scale
This is an old revision of the document!
Edge Detection, Toggle and Range Conversion
| Command | Return Value | Description |
|---|---|---|
Iup(id, input) | true only on the rising edge | Detects each OFF→ON transition once. |
Idown(id, input) | true only on the falling edge | Detects each ON→OFF transition once. |
Ialt(input, state) | None | Toggles the reference variable state at each input rising edge. |
Iscale(x, inMin, inMax, outMin, outMax) | int32_t | Converts an integer range to an integer range. |
Iscalef(x, inMin, inMax, outMin, outMax) | float | Converts a floating-point range to a floating-point range. |
bool lamp = false; void loop() { bool button = Ibounce(0, 30); Ialt(button, lamp); digitalWrite(64, lamp); }
Command Prototypes
| Return Type | Command Prototype |
|---|---|
bool | Iup(uint8_t id, bool input) |
bool | Idown(uint8_t id, bool input) |
void | Ialt(bool input, bool &state_var) |
int32_t | Iscale(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max) |
float | Iscalef(float x, float in_min, float in_max, float out_min, float out_max) |
Using the same id for different signals may mix their previous states. Do not set the minimum and maximum of the Iscale input range to the same value.
en-us_commands/edge_scale.1788785565.txt.gz · Last modified: by 127.0.0.1
