Page 3 of 7
Fun with Arduino 09 Variables byte int long unsigned
Posted: Sun Jan 27, 2019 10:10 am
by RudyB
Before we continue to work on our User Interface, let's first take a moment to have a closer look at variables and data types. We are going to use ever more variables in the coming videos ... and ... we'll have a look at a pitfall concerning data types that prevented our code from previous video 8 to always work as intended.
Fun with Arduino 09 Variables byte int long unsigned

Fun with Arduino 10 Show Cycle Status and Time with Serial.print
Posted: Thu Jan 31, 2019 2:17 pm
by RudyB
Now that we have our code working, by using the correct data type or by typecasting, we can continue the work on our User interface. The goal in this video is to display the status of our day / night cycle on screen ... is it switched on or off, is it day or night, and what is the currently used day / night time. All this will be dynamically updated.
Fun with Arduino 10 Show Cycle Status and Time with Serial.print

Re: Fun with Arduino - a Series of Introductory Videos
Posted: Thu Jan 31, 2019 2:34 pm
by Brian
Says the video is unavailable?
Re: Fun with Arduino - a Series of Introductory Videos
Posted: Thu Jan 31, 2019 2:37 pm
by RudyB
Strange, it does not do that here with me ...
Re: Fun with Arduino - a Series of Introductory Videos
Posted: Thu Jan 31, 2019 2:39 pm
by RogerB
Yup, same here. When you go to play it you get the "unavailable" message. It is fine if you go directly to YT though. R-
Re: Fun with Arduino - a Series of Introductory Videos
Posted: Thu Jan 31, 2019 2:40 pm
by Brian
Its OK now but this is what was displayed..

Re: Fun with Arduino - a Series of Introductory Videos
Posted: Thu Jan 31, 2019 2:41 pm
by RogerB
I reckon Rudy jumped in quick and fixed it. All working now. R-
Fun with Arduino 11 Keyboard Input via Serial Read and ParseInt
Posted: Sun Feb 03, 2019 8:48 am
by RudyB
The User Interface works, it shows the status if the day / night cycle on screen. We're now going to add the option to change the cycle time via the keyboard. The functions we are going to use are Serial.available(), which tells us that there is new input, and Serial.read() or Serial.parseInt() to read the characters that are typed.
Fun with Arduino 11 Keyboard Input via Serial Read and ParseInt

Fun with Arduino 12 Analog Input, analogRead(), Change Range, map()
Posted: Thu Feb 07, 2019 10:42 am
by RudyB
Now that we can change the cycle time via the PC keyboard, let's have a look at a hardware oriented solution ... a rotating knob. We connect a potentiometer to an analog input and read the voltage with the analogRead() instruction. With the map() instruction we can convert the range from 0-1023 to the range that we like to use for our cycle time, like say 1-9 minutes with a 1 minute step size, or maybe 10-300 seconds, with a 10 second step size.
Fun with Arduino 12 Analog Input, analogRead(), Change Range, map()

Fun with Arduino 13 Timer with millis(), no delay(), Multitasking
Posted: Sun Feb 10, 2019 9:37 am
by RudyB
The delay() statement that we used so far for our timing stalls the Arduino. This leads to a complete lack of feedback when we change the cycle time while the cycle is running. Luckily there is a solution: we can use the Arduino internal clock, which counts milliseconds from the moment the Arduino is started. We can read the clock using the millis() statement and we can decide if it is time for action.
Fun with Arduino 13 Timer with millis(), no delay(), Multitasking
