#128 Nextion and Arduino Timing and Control Part 1

5 Просмотры
Размещено
There is an error in this video if you want to add hours to the timer. You need to add a 3rd variable (va2) and change the code on the start button to:

va0.val=hour.val*3600
va2.val+=min.val*60
va0.val+=va2.val
va0.val+=sec.val
covx va0.val,va1.txt,8,0
prints va1.txt,8

When I compute the minutes in the video I use --- "va0.val+=min.val*60"
This statement adds va0.val to the min.val and then multiplies by 60 instead of multiplying the min.val by 60 and then adding the value.
You can not put parentheses around the formula like the va0.val+=(min.val*60) you will need to add a variable va2 as an integer then add va2.val=min.val*60 then on the next line add va0.val+=va2.val.

I hope that makes sense. I had no idea that the Nextion treated += like that. I learned this based on a comment. Thanks, OB Steve! I usually go through the math but I got a little too careless on this one.

This video covers setting up a timer on the Nextion. Sending the value to the Arduino. Then turning on an LED for the configured amount of time.

If you enjoy the content considering donating a cup of coffee at https://ko-fi.com/cheapcontrols

Usually, we have the documents for these videos on the Cheap Controls website the same day or the next day.

I have started a group on Facebook to make it easier to interact with user-requested videos. Consider looking it up. https://www.facebook.com/pg/cheapcontrols/groups/?ref=page_internal
Категория
Ардуино
Комментариев нет.