en-us_commands:reference:iscale
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_commands:reference:iscale [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1 | en-us_commands:reference:iscale [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| <code cpp> | <code cpp> | ||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | } | ||
| + | |||
| void loop() { | void loop() { | ||
| - | | + | |
| - | int32_t | + | int32_t |
| - | float voltage | + | float filtered2f = analogRead2Avgf(0, 5); // Return the floating-point average of 4–20mA input values. |
| + | float currentmA | ||
| + | if (raw2 == ANALOG_READ2_ERROR || filtered2 == ANALOG_READ2_AVG_ERROR || | ||
| + | filtered2f == (float)ANALOG_READ2_AVG_ERROR || | ||
| + | currentmA == (float)ANALOG_READ2_ERROR) { | ||
| + | Serial.println(" | ||
| + | delay(500); | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | int32_t percent = Iscale((int32_t)raw2, | ||
| + | |||
| + | IanalogWrite2(0, | ||
| + | IanalogWrite2f(1, | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.println(raw2); | ||
| + | Serial.print(" | ||
| + | Serial.println(filtered2); | ||
| + | Serial.print(" | ||
| + | Serial.println(filtered2f, | ||
| + | Serial.print(" | ||
| Serial.println(percent); | Serial.println(percent); | ||
| - | Serial.println(voltage, 2); | + | |
| + | | ||
| + | |||
| + | delay(500); | ||
| } | } | ||
| </ | </ | ||
| Line 31: | Line 59: | ||
| * Out-of-range inputs are clamped to the nearest output endpoint. | * Out-of-range inputs are clamped to the nearest output endpoint. | ||
| * Both commands perform only linear range conversion. They do not replace sensor calibration or electrical protection. | * Both commands perform only linear range conversion. They do not replace sensor calibration or electrical protection. | ||
| + | |||
| + | ===== Built-in Commands in the Same Category ===== | ||
| + | |||
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/iscale.1788785568.txt.gz · Last modified: by 127.0.0.1
