====== IsetCount() ====== ''IsetCount()'' changes the current value of the specified counter. {{:en-us_commands:reference:isetcount.svg?900|IsetCount command operation flow}} ''void IsetCount(uint8_t counter_id, int32_t value)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''IsetCount(counter_id, value)'' | ''uint8_t counter_id'' — Counter number. Supports ''0'' ~ ''255'', the ''uint8_t'' range\\ ''int32_t value'' | ''void'' | Changes the current value of the specified counter. | ===== Example ===== const uint8_t COUNTER_ID = 4; const uint8_t PRESET_BUTTON_PIN = 0; const int32_t PRESET_COUNT = 25; void setup() { 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); // Change the specified counter's current value. Serial.println(F("counter preset to 25")); } previousButton = presetButton; } ===== Precautions ===== * The previous fixed 0~31 restriction has been removed. However, the argument type is ''uint8_t'', so the maximum ID is ''255''. * If insufficient memory prevents allocation of counter state, counter commands return ''false'' or ''0''. * Once created, counter state is retained while the program runs. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:ictu|Ictu() View detailed description]] * [[:en-us_commands:reference:ictd|Ictd() View detailed description]] * [[:en-us_commands:reference:ictud|Ictud() View detailed description]] * [[:en-us_commands:reference:igetcount|IgetCount() View detailed description]] * [[:en-us_commands:reference:ictuddownstate|IctudDownState() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]