How to Use Loops in Arduino Programming - Ultimate Guide to the Arduino #13

  Рет қаралды 4,708

Circuit Basics

Circuit Basics

Күн бұрын

Пікірлер: 5
@Drxxx
@Drxxx Жыл бұрын
Amazing ❤
@Norige
@Norige Жыл бұрын
Why is the while-loop stopping when you didn't read the button again inside the loop???
@jasonericson2678
@jasonericson2678 6 ай бұрын
Yes, to get this to work: void loop() { int buttonState = digitalRead(buttonPin); while (buttonState == LOW) { digitalWrite(LEDPin, HIGH); delay(200); digitalWrite(LEDPin, LOW); delay(200); buttonState = digitalRead(buttonPin); } }
@hetori9918
@hetori9918 Жыл бұрын
so in the first example showcasing the while loop command, line10 declares "int buttonState = digitalRead(buttonPin)" to store the pin#7's high or low signal. Using while (buttonState == LOW) to trigger the LED to be ON and OFF codes using button here at 4:17, I found out that the "while" loop command only needs one condition check, after that It will repeatedly run codes. so the button became a onetime trigger. so I changed the "while" to "if", The problem was solved, and now the button can control the LED to be ON and OFF. guess the difference between "while" and "if" is, the "if" command checks the condition true or false every time, "while" only checks once.
@zirconiumvetsel
@zirconiumvetsel 3 ай бұрын
or you can still use "while", but add one line of statement at the end. " buttonState = digitalRead(buttonPin); "
Arduino Tutorial 17: Understanding Arduino While Loops
21:05
Paul McWhorter
Рет қаралды 200 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Arduino MASTERCLASS | How to Use Control Structures PART 6
21:39
Programming Electronics Academy
Рет қаралды 37 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
Using tabs to organize code with the Arduino IDE
12:18
Programming Electronics Academy
Рет қаралды 62 М.
3 Hours vs. 3 Years of Blender
17:44
Isto Inc.
Рет қаралды 6 МЛН
I Made The Ultimate Cheating Device
9:39
ChromaLock
Рет қаралды 1,8 МЛН
Beginner's Guide to Controlling Stepper Motors with Arduino
9:59
Rachel De Barros
Рет қаралды 43 М.
The BEST Mechanical Display You've EVER Seen!!!
13:51
Tin Foil Hat
Рет қаралды 548 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН