commands:reference:iscalef
문서의 이전 판입니다!
Iscalef()
Iscalef()는 실수 입력값을 지정한 실수 범위로 변환합니다.
float Iscalef(float x, float in_min, float in_max, float out_min, float out_max)
명령어
| 명령어 | 인수 | 반환값 | 동작 |
|---|---|---|---|
Iscalef(x, in_min, in_max, out_min, out_max) | float x — 변환할 입력값float in_minfloat in_maxfloat out_minfloat out_max | float | 실수 입력값을 지정한 실수 범위로 변환합니다. |
예제
void loop() { int32_t raw = (int32_t)analogRead(A0); int32_t percent = Iscale(raw, 0, 1023, 0, 100); float voltage = Iscalef((float)raw, 0.0F, 1023.0F, 0.0F, 5.0F); Serial.println(percent); Serial.println(voltage, 2); }
주의사항
Iscale()의 모든 인수와 반환값 범위는-2147483648~2147483647이다.- 범위를 벗어난 입력은 가까운 출력 끝값으로 제한된다.
- 두 명령어는 선형 범위 변환만 수행하며 센서 보정이나 전기적 보호를 대신하지 않는다.
commands/reference/iscalef.1788260660.txt.gz · 마지막으로 수정됨: 저자 127.0.0.1
