Hey all! First time posting around here. I have had an arduino for years and have always made simple things just to learn and "waste some time". Recently I have been working on a program that will test the pressure of a tube and after a certain sample time will return a pass or fail. I have the code working right now to wait the whole sample time before it returns a pass or fail. What I would like to do is have the program return a fail immediately instead of waiting on the delay() to finish. I just cant seem to figure it out! Thanks for all of the help so far! P.S. How should I attach my code?
Look in the IDE examples (File, Examples, Digital) for the blink without delay sketch. It will show how to use millis() for timing in a non-blocking manner.
This post is also very useful.
I have looked through that for days and am getting nowhere.
Then post your code and maybe we can help.
int at_pressure = 7;
int testing_led = 13;
int pass_led = 8;
int fail_led = 9;
int var = 0;
var = 0;
while(var < 8)
instead of blinking i would like to do a solid light and have it wait for 15 seconds to produce a pass or if it fails i would like it to show it immediately.
So the sequence is?
turn off all LEDs if pressure high start test, turn on testing LED for 15 seconds, monitor pressure if pressure goes low before 15 seconds, light fail LED, turn off testing LED. if after 15 seconds pressure still high, light pass LED, turn off testing LED.
I know i need to use millis() but i am unsure how to make it work in my code.
wahooper1: ... P.S. How should I attach my code?
Use code tags:
[code] ... your code ... [/code]
wahooper1: I have looked through that for days and am getting nowhere.
If you explain what part of Several Things at a Time you don't understand I will try to help.