目次

analogReadInit()

analogReadInit()はアナログ入力モジュールのサンプリング速度を設定します。

analogReadInit コマンドの動作フロー

void analogReadInit(uint16_t sps)

コマンド

コマンド 引数 戻り値 動作
analogReadInit(sps) uint16_t sps void アナログ入力モジュールのサンプリング速度を設定します。

使用例

void setup() {
  Serial.begin(115200);
 
  // 自動補完定数を使用
  analogReadInit(IANALOG_SPS_250);  // アナログ入力モジュールのサンプリング速度を設定します。
}
 
void loop() {
  for (uint8_t ch = 0; ch < 4; ch++) {
    Serial.print("CH");
    Serial.print(ch);
    Serial.print(" = ");
    Serial.println(analogRead(ch));  // 指定チャンネルの生のアナログ値を読み取ります。
  }
}

注意事項

同じカテゴリの内蔵コマンド

← 内蔵コマンド一覧