User Tools

Site Tools


en-us_commands:reference:ianalogfilter

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:ianalogfilter [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:ianalogfilter [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-int32_t filtered = IanalogFilter(0, analogRead(A0), 10);+void setup() { 
 +  Serial.begin(115200); 
 +  analogReadInit(IANALOG_SPS_128);  // Set the analog input module's sampling rate. 
 +
 + 
 +void loop() { 
 +  const int32_t raw = analogRead(A0);  // Read the raw analog value of the specified channel. 
 +  const int32_t filtered = IanalogFilter(0, raw, 10);  // Process the supplied value using a moving average. 
 +  static int32_t previous = 0; 
 +  if (abs(filtered - previous) >= 5) { 
 +    previous = filtered; 
 +    Serial.println(filtered); 
 +  } 
 +}
 </code> </code>
  
Line 25: Line 38:
   * 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.
 +
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/ianalogfilter.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki