en-us_commands:reference:ictu
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en-us_commands:reference:ictu [2026/09/07 23:35] – 바깥 편집 127.0.0.1 | en-us_commands:reference:ictu [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ||
| - | | '' | + | | '' |
| + | |||
| + | **Beginner-friendly explanation** | ||
| + | |||
| + | '' | ||
| + | |||
| + | Read the call '' | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | Call it continuously from '' | ||
| Line 17: | Line 30: | ||
| <code cpp> | <code cpp> | ||
| const uint8_t COUNTER_ID = 0; | const uint8_t COUNTER_ID = 0; | ||
| - | const int32_t BOX_CAPACITY = 20; | + | const uint8_t ITEM_SENSOR_PIN = 0; |
| + | const uint8_t RESET_BUTTON_PIN = 1; | ||
| + | const uint8_t FULL_LAMP_PIN = LED_BUILTIN; | ||
| + | const int32_t BOX_CAPACITY = 5; | ||
| void setup() { | void setup() { | ||
| Line 24: | Line 40: | ||
| void loop() { | void loop() { | ||
| - | const bool itemSensor = 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 itemSensor = digitalRead(ITEM_SENSOR_PIN) == HIGH; |
| - | const bool resetButton = 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. | + | const bool resetButton = digitalRead(RESET_BUTTON_PIN) == HIGH; |
| const bool boxFull = Ictu(COUNTER_ID, | const bool boxFull = Ictu(COUNTER_ID, | ||
| - | digitalWrite(32, boxFull ? HIGH : LOW); | + | digitalWrite(FULL_LAMP_PIN, boxFull ? HIGH : LOW); |
| + | |||
| + | static bool previousBoxFull = false; | ||
| + | if (boxFull && !previousBoxFull) { | ||
| + | Serial.println(F(" | ||
| + | } | ||
| + | previousBoxFull = boxFull; | ||
| } | } | ||
| </ | </ | ||
| Line 33: | Line 55: | ||
| ===== Precautions ===== | ===== Precautions ===== | ||
| - | * The previous fixed 0~31 restriction has been removed. However, the argument type is '' | + | * '' |
| - | * If insufficient memory prevents allocation of counter state, counter commands return | + | * When '' |
| - | * Once created, counter state is retained while the program runs. | + | * Set '' |
| + | * Input changes can be missed when sensor pulses are faster than '' | ||
| + | * Use a different '' | ||
| + | * Use '' | ||
| + | |||
| + | ===== Built-in Commands in the Same Category ===== | ||
| + | |||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/ictu.1788791734.txt.gz · Last modified: by 127.0.0.1
