Table of Contents

analogReadInit()

analogReadInit() sets the sampling rate of the analog input module.

analogReadInit command operation flow

void analogReadInit(uint16_t sps)

Commands

Command Arguments Return Value Operation
analogReadInit(sps) uint16_t sps void Sets the sampling rate of the analog input module.

Example

void setup() {
  Serial.begin(115200);
 
  // Use autocomplete constants
  analogReadInit(IANALOG_SPS_250);  // Set the analog input module's sampling rate.
}
 
void loop() {
  for (uint8_t ch = 0; ch < 4; ch++) {
    Serial.print("CH");
    Serial.print(ch);
    Serial.print(" = ");
    Serial.println(analogRead(ch));  // Read the raw analog value of the specified channel.
  }
}

Precautions

Built-in Commands in the Same Category

← Built-in Command List