commands:reference:ibounceon
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| commands:reference:ibounceon [2026/09/01 20:04] – 만듦 - 바깥 편집 127.0.0.1 | commands:reference:ibounceon [2026/09/08 00:53] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 11: | 줄 11: | ||
| ^ 명령어 ^ 인수 ^ 반환값 ^ 동작 ^ | ^ 명령어 ^ 인수 ^ 반환값 ^ 동작 ^ | ||
| | '' | | '' | ||
| + | |||
| ===== 예제 ===== | ===== 예제 ===== | ||
| <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); // 입력이 OFF에서 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(" | ||
| + | } | ||
| } | } | ||
| </ | </ | ||
| 줄 23: | 줄 41: | ||
| '' | '' | ||
| + | |||
| + | ===== 같은 카테고리의 내장 명령어 ===== | ||
| + | |||
| + | * [[commands: | ||
| + | * [[commands: | ||
| + | * [[commands: | ||
| [[commands: | [[commands: | ||
commands/reference/ibounceon.1788260660.txt.gz · 마지막으로 수정됨: 저자 127.0.0.1
