so basically i am making a time bomb that pops a baloon when the tier ends. i actually made the project but i want to add some features that i need help with.but first let me explain the current status of my project, the whole thing contains and arduino uno a bread board a rgb led a buzzer a liquid crystal 16x2 isquarec lcd and a 9gram servo moter and a small tactile buuton.to use it forst we plug it in then the servo snaps to the reesting position and the lcd displays bomb is armed and the rgb led emmits a green ligth once u pres the button the lcd displays that the bomb will explode in 10 sconds and then switches to a 10 second timer will the lcd is counting down the led switches to red and the buzzer and the led both flash every second once the timer has ended the servo move 180 degrees and pops a balloon.
Now let me explain my problem now i want the led and the buzzer to start beeping and flashing slowly and contnusly gets faster and faster until the servo moves and but now the lcd and the buzzer and led are on diffrent time delays(btw i dont know how to make a timer so my current one is like)
lcd.print("10");
delay(1000)
lcd.clear();
lcd.print("9");
so on...
so yeah thats what i need help with btw im a begneer so please use terms i will understand .thank you for reading!!
Welcome to the forum
As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming Questions category of the forum
As to your question
See Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE
are u a bot or an actual person?
Me ?
I hope and believe he is an actual person. He is here for years.
Just check his old posts.
Maybe this bot has been here for years
I would suggest to look at
- Using millis() for timing. A beginners guide
- Several things at the same time
- Flashing multiple LEDs at the same time
you might also benefit from studying state machines. Here is a small introduction to the topic: Yet another Finite State Machine introduction
PS: moderators and long standing contributors are not bots and we see the same mistakes or questions over and over again, so we do use canned replies for those (like the links above are entered through a shortcut )
look this over
const byte PinLed = LED_BUILTIN;
enum { Off = HIGH, On = LOW };
unsigned long MsecSec = 1000;
unsigned long msec0;
int secBomb;
int secAlert = 10;;
bool armed;
void
armBomb (
int sec )
{
secBomb = 20;
armed = true;
}
void
loop (void)
{
unsigned long msec = millis ();
if (! armed)
return;
if (msec - msec0 >= MsecSec) {
msec0 += MsecSec;
secBomb--;
Serial.println (secBomb);
if (10 >= secBomb)
digitalWrite (PinLed, ! digitalRead (PinLed)); // toggle on/off
if (0 == secBomb) {
Serial.println (" boom");
digitalWrite (PinLed, Off);
armed = false;
}
}
}
void
setup (void)
{
Serial.begin (9600);
pinMode (PinLed, OUTPUT);
digitalWrite (PinLed, Off);
armBomb (20);
}
You mean the buzzer and led are on the same delay as each other but a different delay to the LCD?
If so, I think this could be done with for-loops and delay()s. I don't think you truly need to achieve multitasking or use millis(). There is nothing else truly asynchronous going on, at least nothing you have mentioned.
I think you’ll get more help if you take the trouble to punctuate your post. I gave up after a few lines.
I was the first reader of his post and tried to paraphrase it and then failed. Now, I will take the help of AI.
Here's a paraphrased version of OP's text of post #1 generated by AI. Does it make sense?
So essentially, I'm working on a time-triggered device designed to pop a balloon when the timer runs out.
I've already completed the basic setup but want to add some additional features, and I need help with that.
Let me first describe the current state of my project.
The setup includes an Arduino Uno, a breadboard, an RGB LED, a buzzer, a 16x2 I2C LCD, a 9-gram servo motor, and a small tactile button.
To use the device, you start by plugging it in, which causes the servo to move to its resting position, and the LCD displays "Bomb is armed," with the RGB LED glowing green.
Once you press the button, the LCD shows that the bomb will explode in 10 seconds and then switches to a 10-second countdown timer.
During the countdown, the LED turns red, and both the LED and buzzer flash every second.
When the timer finishes, the servo rotates 180 degrees and pops a balloon.
Now, here's where I'm having trouble:
I want the LED and buzzer to start off by flashing and beeping slowly, then gradually increase in speed until the servo activates.
However, my current setup has the LCD, buzzer, and LED on different time delays, and I’m not sure how to create a proper timer for this effect.
Nice work! Maybe the OP can resubmit that to ChatGPT and tell us what the new code looks like?
If OP agrees with that paraphrased version (post #12) of his original text of post #1, then Forum Members may come forward to develop multi-tasking sketch using Arduino UNO R3 and Arduino_FreeRTOS as ChatGPT genertaed sketch is not much appreciated by the veteran members of this Forum.
OP may consult this thread for the basics of multi-tasking using Arduino UNO R3 and Arduino_FreeRTOS.
OK. If anyone wants it, let me know and I’ll post ChatGPT’s response to me using your succinct request verbatim. FWIW, of course!
Wait, what?
I thought y'all just typed really fast and had better functioning memories than I.
a7
Please! There is no need to get out a blowtorch for this butter.
The links in @J-M-L's #7 above will help with the DIY "multi tasking" that has sufficed for uncountable projects on the UNO and other similarly powerful microprocessor boards.
a7
But, there is the option.
I type really fast the shortcut that is expanded into the full text, so I need a good memory to remember my shortcuts
if I type python!
then it will expand into
I've written a small tutorial on interfacing with Python. See Two ways communication between Python3 and Arduino
if I type rules!
then I get
Hello, do yourself a favour and please read How to get the best out of this forum and post accordingly (including code with code tags and necessary documentation for your ask like your exact circuit and power supply, links to components etc).
if I type règles!
then I get
La rédaction de votre message ne répond pas aux critères attendus. Il n'aura sans doute pas de réponse tant que vous n'aurez pas pris en compte et mis en application les recommandations listées dans "Les bonnes pratiques du Forum Francophone”
if I type category!
I get
I moved your topic to an appropriate forum category.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
if I type fsm!
I get
you might benefit from studying state machines. Here is a small introduction to the topic: Yet another Finite State Machine introduction
I probably have 50 of those accumulated over the years, in English, French , Italian, German...
A Leonardo programmed with a number of my most used replies triggered from a keypad comes in handy for me