IsetCount() changes the current value of the specified counter.
void IsetCount(uint8_t counter_id, int32_t value)
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
IsetCount(counter_id, value) | uint8_t counter_id — Counter number. Supports 0 ~ 255, the uint8_t rangeint32_t value | void | Changes the current value of the specified counter. |
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; }
uint8_t, so the maximum ID is 255.false or 0.