| Command | Arguments | Return Value | Operation |
|---|---|---|---|
analogRead(pin) | uint8_t pin — On MPAINO, 0 ~ 19 are overall analog input module channel numbers | int | Reads the raw analog value of the specified channel. |
This example uses MPAINO-8A8R(T) with two X input modules. Select Analog Input Module → X2 in Arduino IDE. CH0 on X1 is 0; CH0 on X2 is 4.
void setup() { Serial.begin(115200); } void loop() { const int first = analogRead(0); // Read the raw analog value from X1 CH0. const int second = analogRead(4); // Read the raw analog value from X2 CH0. Serial.print(F("X1 CH0: ")); Serial.println(first); Serial.print(F("X2 CH0: ")); Serial.println(second); delay(500); }
analogRead(0~19) returns a raw ADS1118 ADC value, not a value converted to voltage, current or temperature units.analogRead2(A pin) on MPINO or analogRead2(module channel) on MPAINO.analogReadInit(sps). If not configured, it follows the analogRead() default.20. If samples = 0 or memory allocation fails, return the current raw value.