User Tools

Site Tools


en-us_commands:reference:ictuddownstate

This is an old revision of the document!


IctudDownState()

IctudDownState() returns the lower-limit completion state of the Up/Down counter.

IctudDownState command operation flow

bool IctudDownState(uint8_t counter_id)

Commands

Command Arguments Return Value Operation
IctudDownState(counter_id) uint8_t counter_id — Counter number. Supports 0 ~ 255, the uint8_t range bool Returns the lower-limit completion state of the Up/Down counter.

Example

const uint8_t COUNTER_ID = 5;
const int32_t RACK_CAPACITY = 100;
 
void setup() {
  Serial.begin(115200);
}
 
void loop() {
  const bool entered = IdigitalRead(0, 5);  // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state.
  const bool exited = IdigitalRead(1, 5);  // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state.
  Ictud(COUNTER_ID, entered, exited, false, false, RACK_CAPACITY);  // Process up and down inputs with one counter.
  const bool rackEmpty = IctudDownState(COUNTER_ID);  // Return the up/down counter's lower-limit completion state.
  digitalWrite(33, rackEmpty ? HIGH : LOW);
}

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 Command List

en-us_commands/reference/ictuddownstate.1788791734.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki