Arduino Tutorial 08 - Switch-Case and While

preview_player
Показать описание
The eighth in a series of introductory Arduino tutorial videos.
If you have any questions or comments, please post below.

This video explains and demonstrates the "switch / case", "while" and "do, while". A photocell is also introduced.

A breakdown of the example code is provided, explaining the purpose of each line and component.

Рекомендации по теме
Комментарии
Автор

The memory location of lightVal?

You seem to be calling it as a int inside the while which could be setting it as new rather than replace. Try it without the int inside the while

Elstarda
Автор

Nice Ryan. Good work. 

I am working on a project based on 2 sensors which work with one LED (one will turn it On and another one will turn it off, for 3000 times (without timers)). Dont know how to use switch-case for that outcome. 

Please help.

hamid
Автор

Hi Ryan
What if i want to use a button to shift between 5 different cases and the cases should loop until the button i pressed again?

Like first case is the AnalogInOutSerial, case 2 is Fade example and so on?
I want the fade example to loop until the button is pressed and then it goes on to the next program. :)

Nqrgaard
Автор

Hi just wondering what the fix was for the While loop problem was as i have similar problem and i just can't figure it out

electro
Автор

So would be

lightVal = analogRead(lightPin);

Elstarda
visit shbcf.ru