Multitasking with Arduino | Relay Timer Controller
ฝัง
- เผยแพร่เมื่อ 20 ก.ค. 2020
- In this video, I demonstrate a relay timer controller. It is implementing millis function to achieve multitasking.
In here the following task are separate task to demonstrate multitasking:
1. The ON state of the relay (simulated through the LED)
2. Navigating the LCD menu by using buttons
For more details, (circuit diagram and source code) visit my blog post:
techtotinker.com/2020/07/22/m...
If you find this video as helpful, please give me thumbs up and Share this to your friends.
Leave your comments in the comment box.
Please do not forget to Subscribe.
Thank you and have a good day. - วิทยาศาสตร์และเทคโนโลยี
great work sir
Nice project
Thank you Amar.
Link error.
Using your example, could you have one input to initiate executing all three after setting the individual timers
Best Example
Wow. Thanks for the appreciation.
Thanks. really helpful. More Please add timer in milliseconds
Hi @Dean Lee, I believe its already in milliseconds. millis() function returns a value in milliseconds. Thanks, cheers.
@@TechToTinker Thanks. Cool
Hey. Your video was very useful. But i have a problem that everytime i reboot the controller, the set value is erased. Can you make a video with saving the values in eeprom?
Please More on this topic. All about time Scheduler
Hi @Dean Lee, we will see in the future. Thank you for your suggestion.
Respcted Sir,
Thanks for video,
Sir, yet i didnot found code for the, if during process the displayed value (analog signal) start increasing toward maximum value, at one point of time it will become constant(now not increasing), one pin of microcontroller will 'LOW' (initially high)
Sir can you help.
muito bom
Thank you Jose.
Can you provide a similar program but made the port timings in loop; first port (led) on for X-amount of time, second port (led) on for X-amount of time and so on. I would need such a program to control up to five relays in sequence one after another, then stop. Then execute with trigger pulse.
You may email me at tech.to.tinker@gmail.com if you still need this request. Cheers.
I also want to ask this same question?
I measure weight with arduino and then print with thermal printer. currently measuring and printing. but what I want is to have the button active after measuring. ie multitasking. can you help me
void loop()
{
do
{
currentTimeAnimation=millis();
if (currentTimeAnimation-previousTimeAnimation>=animationInterval)
{
//350ms geçti
lc.clearDisplay(0);
lc.clearDisplay(1);
lc.clearDisplay(2);
lc.clearDisplay(3);
lc.clearDisplay(4);
lc.clearDisplay(5);
setAnimationPoint(animationCounter);
animationCounter++;
if (animationCounter==6)
{
animationCounter=0;
}
previousTimeAnimation=currentTimeAnimation;
}
} while(digitalRead(7)==HIGH);
measureHeight();
measureWeight();
delay(1000);
measureHeight();
measureWeight();
delay(1000);
measureHeight();
measureWeight();
delay(1000);
wdt_reset();
turnOffDisplays();
delay(500);
displayWeight();
digitalWrite(13, HIGH);
delay(500);
turnOffDisplays();
digitalWrite(13, LOW);
delay(500);
displayWeight();
digitalWrite(13, HIGH);
delay(500);
turnOffDisplays();
digitalWrite(13, LOW);
delay(500);
displayWeight();
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
wdt_reset();
previousTimeButton=millis();
do
{
currentTimeButton=millis();
if (currentTimeButton-previousTimeButton>=buttonInterval)
{
yazdirSureBitti=true;
break;
}
} while(digitalRead(yazdirPin)==HIGH);
//Buton basma için zaman geçti
if (yazdirSureBitti==false)
{
print();
}
yazdirSureBitti=false; //
}
How place pin SDA, SCL if using i2c modul..?
@ulya panwa, what do you mean?
Nice 👍 job but make menu more simple to operate
Thank you @Nabeel Ahmed, we will see. Cheers
How you use RTOS and State Machine
Hi Raam, in this video I use a millis() function which is a easier to use. RTOS and State Machine could be, could be may next tutorial.
By the way, thank you for visiting TechToTinker channel :)
@@TechToTinker Okay Thank you, Please Explain in Next Tutorial Deeply How it is Working by RTOS...
Dear sir can u make in all funtion with one task in one time, can u make for me
@Viral In World, what do you want to achieve?
Can i set it up to2 hrs?
Hi @B&A FX ANALYSIS, yes you can. Just set the interval to 7,200,000. That's 2 hours x 60 minutes x 60 seconds x 1000 milliseconds.
its continue cycle code?
Yes, it is
Hi. can I see the wiring diagram?