Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Hi everyone, i started coding embedded C recently, based on my understanding of While loop it loops over the code as long as the while loop condition remains true, in my simple Led chaser code on ATmega324 bord i was expecting it to break as soon as i released the button switch but the loop kept executing every single line inside it and the LEDs kept lighting up.
i came with a solution which was adding a For loop with an IF statement inside it to check if the push button is still pressed.
but am still wondering why would the while loop keep on going while the condition is not TRUE anymore. “i believe that an IF statement would do that not a while loop”
#define F_CPU 16000000UL //define the 16 MHZ crystal Clock
#include
#include
#define BUTTON_PIN (1<
CONTRIBUTE TO THIS THREAD