Questions tagged [delay]

9 questions
5
votes
1 answer

What does a delay(0) actually do?

I've seen some code where the developers add delay(0), it doesnt make sense, what does it do? Delay with zero milliseconds, why? bool DFRobotDFPlayerMini::waitAvailable(unsigned long duration){ unsigned long timer = millis(); if (!duration) { …
Sigma
  • 296
  • 3
  • 13
2
votes
0 answers

How to input delay and increase volume measurements with hall sensor detection

I'm writing code so that, every time a hall monitor senses, my code additively measures 5 liters of volume as it prints each detection. Then, this data is sent via Bluetooth to a phone. (This is for a tipping bucket device that distributes 5 liters…
2
votes
1 answer

How to Independently run positional and continuous servos using millis()?

I am setting up 3 servos (2 position servos and 1 '360' continuous rotational servo) with Arduino. but I failed to run these independently. It runs one after another. I wish to run it in loop independent to each other. Here is the code which I use…
Emlinux
  • 43
  • 4
1
vote
2 answers

Is there a need to put a delay in the main loop

Im a complete beginner. Generally speaking, is there any need at all to have a delay in the main loop()? Im not used to writing infinite loops Is it correct to say that the delay() command is simply helpful for tutorials (i.e turn light on, wait,…
0
votes
1 answer

Using Millis instead of delay to reboot relay

I want to reboot relay (turn off , waiting 4 seconds and turn ON) it works perfectly if I use delay(4000), but code is blocked while delay (4 seconds) and I cant start relay 2. How can I use Millis instead of delay to reboot relay 1 and start relay…
vito
  • 101
  • 3
0
votes
1 answer

Tone() function pauses between notes

I tried to experiment with the tone() function that comes with the arduino library. I played around with the standard code example located here: https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody This is the code: #include…
user1584421
  • 1,349
  • 3
  • 19
  • 32
0
votes
3 answers

Using 1 ms delay() in a for loop to check inputs.. Bad?

So first off, I know millis() exists. Just asking out of curiosity. Say you have a button you wanna check for during a delay.. Maybe a 10 second delay. So you make a for loop that checks for input and delays 1 ms... 10,000 times. What's bad about…
BobaJFET
  • 135
  • 8
0
votes
1 answer

Question about using millis for alarm conditions - Arduino

I am new to programming in general and to Arduino as well. I am working on a small project to improve my ability to write complete and kind of useful programming sketches. I am facing a problem. I am using a few things in my circuit like 7-segment…
Maher
  • 9
  • 3
0
votes
1 answer

Random "Compilation error: Error: 13 INTERNAL: exit status 1". No clue how to resolve or even what causes this error

I am a beginner with Arduino. I have a program that is intentionally simple. The code refuses to compile, spitting out the error Compilation error: Error: 13 INTERNAL: exit status 1. I have gotten this type of error multiple times, and I have no…