en-us_commands:reference:ibounceon
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_commands:reference:ibounceon [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1 | en-us_commands:reference:ibounceon [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| <code cpp> | <code cpp> | ||
| - | if (IbounceOn(0, 50)) { | + | const uint8_t START_INPUT = 0; |
| - | digitalWrite(32, HIGH); | + | const uint8_t STOP_INPUT = 1; |
| + | const uint8_t RUN_OUTPUT = 32; | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | const bool start = IbounceOn(START_INPUT, 100); // Apply the time filter only when the input changes from OFF to ON. | ||
| + | const bool stop = IbounceOff(STOP_INPUT, | ||
| + | const bool run = start && !stop; | ||
| + | digitalWrite(RUN_OUTPUT, run ? HIGH : LOW); | ||
| + | |||
| + | static bool previousRun = false; | ||
| + | if (run != previousRun) { | ||
| + | previousRun = run; | ||
| + | Serial.println(run ? F(" | ||
| + | } | ||
| } | } | ||
| </ | </ | ||
| Line 24: | Line 41: | ||
| The '' | The '' | ||
| + | |||
| + | ===== Built-in Commands in the Same Category ===== | ||
| + | |||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/ibounceon.1788785566.txt.gz · Last modified: by 127.0.0.1
