en-us_commands:reference:analogread
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_commands:reference:analogread [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1 | en-us_commands:reference:analogread [2026/09/14 20:30] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| ===== Example ===== | ===== Example ===== | ||
| + | |||
| + | This example uses MPAINO-8A8R(T) with two X input modules. Select **Analog Input Module → X2** in Arduino IDE. CH0 on X1 is '' | ||
| <code cpp> | <code cpp> | ||
| Line 21: | Line 23: | ||
| void loop() { | void loop() { | ||
| - | int ai0 = analogRead(0); | + | |
| - | int ai4 = analogRead(4); | + | |
| - | int32_t avg0 = analogReadAvg(0, | + | Serial.print(F("X1 CH0: ")); |
| - | float avg0f = analogReadAvgf(0, | + | Serial.println(first); |
| - | + | Serial.print(F("X2 CH0: ")); | |
| - | Serial.print(" | + | Serial.println(second); |
| - | Serial.println(ai0); | + | |
| - | + | ||
| - | Serial.print("AI4: "); | + | |
| - | Serial.println(ai4); | + | |
| - | + | ||
| - | Serial.print("AI0 AVG: "); | + | |
| - | Serial.println(avg0); | + | |
| - | + | ||
| - | Serial.print(" | + | |
| - | Serial.println(avg0f, 2); | + | |
| delay(500); | delay(500); | ||
| } | } | ||
| Line 50: | Line 41: | ||
| * Using both averaging functions allocates separate dynamic buffers and increases SRAM usage. | * Using both averaging functions allocates separate dynamic buffers and increases SRAM usage. | ||
| * The MPAINO analog input module' | * The MPAINO analog input module' | ||
| + | |||
| + | ===== Built-in Commands in the Same Category ===== | ||
| + | |||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/analogread.1788785565.txt.gz · Last modified: by 127.0.0.1
