ja-jp_commands:reference:ictud
文書の過去の版を表示しています。
Ictud()
Ictud()は増加入力と減少入力を1つのカウンタで処理します。
bool Ictud(uint8_t counter_id, bool CU, bool CD, bool RESET, bool LOAD, int32_t PV)
コマンド
| コマンド | 引数 | 戻り値 | 動作 |
|---|---|---|---|
Ictud(counter_id, CU, CD, RESET, LOAD, PV) | uint8_t counter_id — カウンタ番号。uint8_tの範囲のため0 ~ 255を使用可能bool CUbool CDbool RESETbool LOADint32_t PV — 設定値 | bool | 増加入力と減少入力を1つのカウンタで処理します。 |
使用例
const uint8_t COUNTER_ID = 2; 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; const bool reset = digitalRead(2) == HIGH; const bool preset = digitalRead(3) == HIGH; const bool full = Ictud(COUNTER_ID, entered, exited, reset, preset, RACK_CAPACITY); // 加算入力と減算入力を1つのカウンタで処理します。 digitalWrite(32, full ? HIGH : LOW); }
注意事項
- 従来の0~31固定制限は削除されました。ただし引数型が
uint8_tのため、最大IDは255です。 - メモリ不足でカウンタ状態を確保できない場合、カウンタコマンドは
falseまたは0を返します。 - 一度作成したカウンタ状態はプログラム実行中保持されます。
同じカテゴリの内蔵コマンド
ja-jp_commands/reference/ictud.1788796399.txt.gz · 最終更新: by 127.0.0.1
