====== IbounceOn() ====== ''IbounceOn()'' applies the time filter only when the input changes from OFF to ON. {{:en-us_commands:reference:ibounceon.svg?900|IbounceOn command operation flow}} ''bool IbounceOn(uint8_t pin, uint32_t debounceTime)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''IbounceOn(pin, debounceTime)'' | ''uint8_t pin'' — Input pin number\\ ''uint32_t debounceTime'' — Stable-state confirmation time (ms) | ''bool'' | Applies the time filter only when the input changes from OFF to ON. | ===== Example ===== const uint8_t START_INPUT = 0; 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, 100); // Apply the time filter only when the input changes from ON to OFF. const bool run = start && !stop; digitalWrite(RUN_OUTPUT, run ? HIGH : LOW); static bool previousRun = false; if (run != previousRun) { previousRun = run; Serial.println(run ? F("motor RUN") : F("motor STOP")); } } ===== Precautions ===== The ''Ibounce'' functions retain state, so keep calling them in ''loop()''. Specify the actual pin or logical channel for your product. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:idigitalread|IdigitalRead() View detailed description]] * [[:en-us_commands:ibounce|Ibounce() View detailed description]] * [[:en-us_commands:reference:ibounceoff|IbounceOff() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]