en-us_commands:reference:igetcount
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_commands:reference:igetcount [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1 | en-us_commands:reference:igetcount [2026/09/14 20:30] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| ===== Example ===== | ===== Example ===== | ||
| + | |||
| + | This example uses the P0 and P1 inputs on MPINO-8A4R(T)-S. | ||
| <code cpp> | <code cpp> | ||
| - | bool Ictu(uint8_t | + | const uint8_t |
| - | bool Ictd(uint8_t counter_id, | + | const int32_t |
| - | bool Ictud(uint8_t counter_id, bool CU, bool CD, bool RESET, bool LOAD, int32_t PV); | + | |
| - | int32_t IgetCount(uint8_t counter_id); | + | void setup() { |
| - | void IsetCount(uint8_t counter_id, int32_t value); | + | Serial.begin(115200); |
| - | bool IctudDownState(uint8_t counter_id); | + | } |
| + | |||
| + | void loop() { | ||
| + | const bool itemSensor = digitalRead(0) == HIGH; | ||
| + | | ||
| + | Ictu(COUNTER_ID, itemSensor, resetButton, BATCH_SIZE); // Count rising input edges and return true when the preset is reached. | ||
| + | |||
| + | const int32_t | ||
| + | | ||
| + | if (current != previous) { | ||
| + | previous = current; | ||
| + | | ||
| + | Serial.println(current); | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| Line 29: | Line 45: | ||
| * If insufficient memory prevents allocation of counter state, counter commands return '' | * If insufficient memory prevents allocation of counter state, counter commands return '' | ||
| * Once created, counter state is retained while the program runs. | * Once created, counter state is retained while the program runs. | ||
| + | |||
| + | ===== Built-in Commands in the Same Category ===== | ||
| + | |||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/igetcount.1788785567.txt.gz · Last modified: by 127.0.0.1
