目次

IctudDownState()

IctudDownState()はUp/Downカウンタの下限完了状態を返します。

IctudDownState コマンドの動作フロー

bool IctudDownState(uint8_t counter_id)

コマンド

コマンド 引数 戻り値 動作
IctudDownState(counter_id) uint8_t counter_id — カウンタ番号。uint8_tの範囲のため0 ~ 255を使用可能 bool Up/Downカウンタの下限完了状態を返します。

使用例

MPINO-8A4R(T)-SのP0・P1入力とP33出力を使用する例です。

const uint8_t COUNTER_ID = 5;
const int32_t RACK_CAPACITY = 100;
 
void setup() {
  Serial.begin(115200);
}
 
void loop() {
  const bool entered = digitalRead(0) == HIGH;
  const bool exited = digitalRead(1) == HIGH;
  Ictud(COUNTER_ID, entered, exited, false, false, RACK_CAPACITY);  // 加算入力と減算入力を1つのカウンタで処理します。
  const bool rackEmpty = IctudDownState(COUNTER_ID);  // アップ/ダウンカウンタの下限完了状態を返します。
  digitalWrite(33, rackEmpty ? HIGH : LOW);
}

注意事項

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

← 内蔵コマンド一覧