I am working on a project with arduino uno that uses a temp sensor to turn on a motor once it goes above a certain temp.
So far, I have set digital pin 3 as an output and using "if" when the temp gets above a certain number(a number i set manually at the moment) it will digtalWrite 3 HIGH, which turns the motor on. So far so good.
Now I want to add a 3 position off-on-on slide switch to power the arduino once I make it portable. When it is off I want it to obviously turn everything off. In the other two on positions I would like it to do the following.
On postion 1...all it needs to do is read the numbers (b/w 0-1023) that are coming in which I believe it is already doing without a switch now??
On position 2...when in this position I would like the arduino to take the last number it read from "on position 1" (so write before the switch gets moved to position 2)and use that number as the new max number. So anything above that number will turn on the motor. It will not be a number I enter manually anymore.
Not sure if I would use if or if...while...or perhaps use millis somehow??
I am also not too sure how to wire it properly either. Would I use 2 more digital pins (one for each on postion)?
Any help would be great...thanks