Table of Contents

IsetCount()

IsetCount() changes the current value of the specified counter.

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

Built-in Commands in the Same Category

← Built-in Command List