User Tools

Site Tools


en-us_commands:edge_scale

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en-us_commands:edge_scale [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:edge_scale [2026/09/12 23:27] (current) – 바깥 편집 127.0.0.1
Line 1: Line 1:
-====== Edge DetectionToggle and Range Conversion ======+====== Edge detection, state toggle, and range conversion ======
  
-^ Command ^ Return Value ^ Description ^ +Detect input transitionstoggle a state, or convert value to another range.
-| ''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(xinMin, inMax, outMin, outMax)'' | ''int32_t'' | Converts an integer range to an integer range. | +
-| ''Iscalef(x, inMin, inMax, outMin, outMax)'' | ''float'' | Converts floating-point range to a floating-point range. |+
  
-<code cpp> +===== Edge Detection =====
-bool lamp false; +
-void loop() { +
-  bool button Ibounce(0, 30); +
-  Ialt(button, lamp); +
-  digitalWrite(64, lamp); +
-+
-</code>+
  
-===== Command Prototypes =====+  * [[:en-us_commands:reference:iup|Iup()]] — Returns ''true'' only at the instant the input changes from OFF to ON. 
 +  * [[:en-us_commands:reference:idown|Idown()]] — Returns ''true'' only at the instant the input changes from ON to OFF.
  
-^ Return Type ^ Command Prototype ^ +===== State Toggle =====
-| ''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:reference:ialt|Ialt()]] — Toggles the specified state ON/OFF at each input rising edge.
  
-[[:en-us_commands:builtin|← Built-in Command List]]+===== Range Conversion ===== 
 + 
 +  * [[:en-us_commands:reference:iscale|Iscale()]] — Converts an integer input value to the specified integer range. 
 +  * [[:en-us_commands:reference:iscalef|Iscalef()]] — Converts a floating-point input value to the specified floating-point range. 
 + 
 +[[:en-us_commands:builtin|← Built-in function list]]
  
en-us_commands/edge_scale.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki