-5

How can I make the press of a button nearly instant, WITHOUT using interrupts or millis() - and NO preset arduino functions, just C. There is a delay at the end of my while loop of 500ms - perhaps the solution lies in breaking up the delay (NOTE: I need to keep the delays)

11
  • Why do you need to keep the delays? Use a variable and check it against the current time, and using state diagram(s) for the part(s) where you think you need the delay for. Feb 13 '18 at 21:20
  • Why don't you want interrupts? Interrupts are expected in almost every serious application on embedded devices!
    – jfpoilpret
    Feb 13 '18 at 21:23
  • That is the constraint - make the button press nearly instant without using interrupts or millis(). How do I check the variable against the current time using C and not built in Arduino functions?
    – LaSzLo
    Feb 13 '18 at 21:32
  • 1
    you can always replace delay() with millis, that constraint sounds like a uni assignment or you getting stuck in an XY problem Feb 13 '18 at 21:33
  • 2
    due to the constraint .... this smells like school work
    – jsotola
    Feb 13 '18 at 22:14
0

You can delay a small period, check button, delay again. Loop this until the full delay is achieved

3
  • I do this with many things, this is the correct answer.
    – user2497
    Feb 14 '18 at 8:19
  • 1
    So then mark it as the correct answer please
    – chrisl
    Feb 14 '18 at 10:49
  • Thanks Chad, this is exactly what I did. Thank you for your correct answer.
    – LaSzLo
    Feb 15 '18 at 8:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.