User Tools

Site Tools


en-us_commands:reference:analogreadavgf

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:analogreadavgf [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:analogreadavgf [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-float value = analogReadAvgf(0, 8); +void setup() { 
-Serial.println(value, 2);+  Serial.begin(115200); 
 +
 + 
 +void loop() { 
 +  int ai0 = analogRead(0);  // Read the raw analog value of the specified channel. 
 +  int ai4 = analogRead(4);  // Read the raw analog value of the specified channel. 
 +  int32_t avg0 = analogReadAvg(0, 5);  // Return the integer average of multiple input values. 
 +  float avg0f = analogReadAvgf(0, 5);  // Return the floating-point average of multiple input values. 
 + 
 +  Serial.print("AI0: "); 
 +  Serial.println(ai0); 
 + 
 +  Serial.print("AI4: "); 
 +  Serial.println(ai4); 
 + 
 +  Serial.print("AI0 AVG: "); 
 +  Serial.println(avg0); 
 + 
 +  Serial.print("AI0 AVG float: "); 
 +  Serial.println(avg0f, 2); 
 + 
 +  delay(500); 
 +}
 </code> </code>
  
Line 26: Line 48:
   * Increasing the sample count slows response and increases memory usage.   * Increasing the sample count slows response and increases memory usage.
   * MPINO ''A0'' and MPAINO ''0'' do not identify the same physical input. Recheck arguments when changing product families.   * MPINO ''A0'' and MPAINO ''0'' do not identify the same physical input. Recheck arguments when changing product families.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:analogreadinit|analogReadInit() View detailed description]]
 +  * [[:en-us_commands:reference:analogread|analogRead() View detailed description]]
 +  * [[:en-us_commands:reference:analogreadavg|analogReadAvg() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/analogreadavgf.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki