User Tools

Site Tools


en-us_commands:reference:iscalef

Differences

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

Link to this comparison view

Next revision
Previous revision
en-us_commands:reference:iscalef [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:iscalef [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-void loop() { +void setup() { 
-  int32_t raw = (int32_t)analogRead(A0); +  Serial.begin(115200); 
-  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); +void loop() { 
-  Serial.println(voltage, 2);+  const float raw = (float)analogRead(A0);  // Read the raw analog value of the specified channel. 
 +  const float pressureBar = Iscalef(raw, 0.0F, 32767.0F, 0.0F, 10.0F);  // Map a floating-point input to the specified floating-point range. 
 +  if (pressureBar >= 0.0F && pressureBar <= 10.0F) Serial.println(pressureBar, 2); 
 +  delay(100);
 } }
 </code> </code>
Line 31: Line 33:
   * 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|Iscale() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/iscalef.1788785568.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki