en-us_commands:reference:analogread2avg
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_commands:reference:analogread2avg [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1 | en-us_commands:reference:analogread2avg [2026/09/14 20:30] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| ===== Example ===== | ===== Example ===== | ||
| + | |||
| + | Connect an X input module to MPAINO-8A8R(T) and select **Analog Input Module → X**. Set CH0 DIP switches 20mA and GND to ON, then connect the 4–20mA signal. | ||
| <code cpp> | <code cpp> | ||
| Line 21: | Line 23: | ||
| void loop() { | void loop() { | ||
| - | | + | |
| - | | + | if (value == ANALOG_READ2_AVG_ERROR) { |
| - | float filtered2f = analogRead2Avgf(0, | + | Serial.println(F(" |
| - | float currentmA = IanalogRead2f(0, | + | } else { |
| - | + | | |
| - | if (raw2 == ANALOG_READ2_ERROR || filtered2 | + | |
| - | filtered2f == (float)ANALOG_READ2_AVG_ERROR || | + | |
| - | currentmA == (float)ANALOG_READ2_ERROR) { | + | |
| - | Serial.println(" | + | |
| - | | + | |
| - | 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.print(" | ||
| - | Serial.println(currentmA, | ||
| - | |||
| delay(500); | delay(500); | ||
| } | } | ||
| Line 56: | Line 35: | ||
| ===== Precautions ===== | ===== Precautions ===== | ||
| - | * Set the module DIP switches | + | * Set the MPAINO X module |
| * An input of approximately 3.6~4.0mA returns the normal value '' | * An input of approximately 3.6~4.0mA returns the normal value '' | ||
| * Error values help detect open circuits. The user must implement final alarms and safety actions in the program. | * Error values help detect open circuits. The user must implement final alarms and safety actions in the program. | ||
| Line 68: | Line 47: | ||
| * The analog output circuit requires an external 12~24V supply. USB power alone may not provide normal output. | * The analog output circuit requires an external 12~24V supply. USB power alone may not provide normal output. | ||
| * Verify actual current input/ | * Verify actual current input/ | ||
| + | |||
| + | ===== Built-in Commands in the Same Category ===== | ||
| + | |||
| + | * [[: | ||
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/analogread2avg.1788785565.txt.gz · Last modified: by 127.0.0.1
