Hey folks, i very need your help.
So here a gas sensor, which need to be heated for 5 and 15 seconds, the data from sensor is taken at 4.985 and 14.985 seconds whilst given a +5 impulse, here how it looks:
digitalWrite(switch1,HIGH);
digitalWrite(power,HIGH);
delay(4985);
digitalWrite(switch2,HIGH);
delay(5);
//analogRead(..
digitalWrite(switch2,LOW);
delay(10);
digitalWrite(switch1,LOW);
delay(14985);
digitalWrite(switch2,HIGH);
delay(5);
//analogRead(...
digitalWrite(switch2,LOW);
delay(10);
so the arduino actually stalls for 20 seconds, so i would most likely prefer to do some stuff in that 20 seconds, like, reading the second sensor or transfer to xbee etc..
obviously, i need to create like timer which will be checked every loop.
like
timer t1;
void setup() { t1.start}
void loop() {
heat();
if (t1 == 14.985) readthesensor()
And so on, hope you got me.
so i know that atmega has some global time which is count of processor ticks, but how can i convert it to seconds?
thanks for reading