Duty Cycles

Does anyone here have a brilliant idea how to measure this:


| | | | | |
| || || |

t2 = |<---->|
t1 = |<--------------->|

I need to measure both t1 and t2, is millis() the way to go?

This is what I try to communicate with: http://www.elfa.se/pdf/73/730/07308869.pdf

Did you check the pulseIn() command ?

http://www.arduino.cc/en/Reference/PulseIn

This is an interesting little temp sensor - I like the TO-220 case, mean you can bolt it to something - you could probably connect it directly to a analogue voltmeter and it would display something related to temperature.

If you don't need the accuracy, you could put it through a RC filter and read the temperature using an analogue in pin.

Mike

Greetings,

unsigned long t1, t2;

void setup()
{
  pinMode(7, INPUT);
}

void loop()
{
  t1 = pulseIn(7, LOW);
  t2 = pulseIn(7, HIGH);
  t1 = t1 + t2; // if needed.
}

Regards,
David