ユーザ用ツール

サイト用ツール


ja-jp_commands:reference:isetcount

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
ja-jp_commands:reference:isetcount [2026/09/07 21:53] – 만듦 - 바깥 편집 127.0.0.1ja-jp_commands:reference:isetcount [2026/10/25 10:18] (現在) – 外部編集 127.0.0.1
行 16: 行 16:
  
 <code cpp> <code cpp>
-bool Ictu(uint8_t counter_id, bool CU, bool RESET, int32_t PV); +const uint8_t COUNTER_ID = 4; 
-bool Ictd(uint8_t counter_id, bool CD, bool LOAD, int32_t PV); +const uint8_t PRESET_BUTTON_PIN = 0; 
-bool Ictud(uint8_t counter_id, bool CU, bool CD, bool RESET, bool LOAD, int32_t PV); +const int32_t PRESET_COUNT = 25; 
-int32_t IgetCount(uint8_t counter_id); + 
-void IsetCount(uint8_t counter_id, int32_t value); +void setup() { 
-bool IctudDownState(uint8_t counter_id);+  Serial.begin(115200); 
 +} 
 + 
 +void loop() { 
 +  const bool presetButton = digitalRead(PRESET_BUTTON_PIN) == HIGH; 
 +  static bool previousButton = false; 
 + 
 +  if (presetButton && !previousButton) { 
 +    IsetCount(COUNTER_ID, PRESET_COUNT);  // 指定カウンタの現在値を変更します。 
 +    Serial.println(F("counter preset to 25")); 
 +  } 
 +  previousButton = presetButton; 
 +}
 </code> </code>
  
行 28: 行 40:
   * 従来の0~31固定制限は削除されました。ただし引数型が''uint8_t''のため、最大IDは''255''です。   * 従来の0~31固定制限は削除されました。ただし引数型が''uint8_t''のため、最大IDは''255''です。
   * メモリ不足でカウンタ状態を確保できない場合、カウンタコマンドは''false''または''0''を返します。   * メモリ不足でカウンタ状態を確保できない場合、カウンタコマンドは''false''または''0''を返します。
-  * 一度作成したカウンタ状態はプログラム実行中保持されます。+  * 一度作成したカウンタの状態は、プログラムの実行中保持されます。 
 + 
 +===== 同じカテゴリの内蔵コマンド ===== 
 + 
 +  * [[:ja-jp_commands:reference:ictu|Ictu() 詳細説明を見る]] 
 +  * [[:ja-jp_commands:reference:ictd|Ictd() 詳細説明を見る]] 
 +  * [[:ja-jp_commands:reference:ictud|Ictud() 詳細説明を見る]] 
 +  * [[:ja-jp_commands:reference:igetcount|IgetCount() 詳細説明を見る]] 
 +  * [[:ja-jp_commands:reference:ictuddownstate|IctudDownState() 詳細説明を見る]]
  
 [[:ja-jp_commands:builtin|← 内蔵コマンド一覧]] [[:ja-jp_commands:builtin|← 内蔵コマンド一覧]]
  
ja-jp_commands/reference/isetcount.1788785591.txt.gz · 最終更新: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki