User Tools

Site Tools


en-us_commands:reference:ictu

This is an old revision of the document!


Table of Contents

Ictu()

Ictu() counts input rising edges and returns true when the preset value is reached.

Ictu command operation flow

bool Ictu(uint8_t counter_id, bool CU, bool RESET, int32_t PV)

Commands

Command Arguments Return Value Operation
Ictu(counter_id, CU, RESET, PV) uint8_t counter_id — Counter number. Supports 0 ~ 255, the uint8_t range
bool CU
bool RESET
int32_t PV — Preset value
bool Counts input rising edges and returns true when the preset value is reached.

Example

void loop() {
  bool pulse = digitalRead(0);
 
  if (Ictu(40, pulse, false, 10)) {
    digitalWrite(13, HIGH);
  }
}

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/ictu.1788785566.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki