Shop OBEX P1 Docs P2 Docs Learn Events
Time measurement — Parallax Forums

Time measurement

leshea2leshea2 Posts: 83
edited 2008-01-23 23:06 in BASIC Stamp

I connected an IR detector to my basic stamp and I’m using an infrared emitting LED to send messages to the detector·also using the·basic stamp, but I want to measure the time it takes per sending/receiving loop. So how do I measure how long it takes for an IR message to be sent and received ?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-23 21:39
    This is hard to do with the Stamp since it has no built-in time clock. It can time some things very precisely, but, because it can do only one thing at a time, it can't really track the time it takes something to get done. The best way to do this is actually manually. You have a program that does some task (like receiving an IR message) say 1000 times and turns on an LED when it starts, then turns it off when it's finished. You use a stopwatch to time the LED on time and divide by 1000.

    For the case you mentioned, you need to couple the send/receive loops so, as soon as the detector sees an IR message, the sending routine stops and when the detector stops seeing the IR message, the sending starts up again. What you're mostly measuring is the response time of the IR detector.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-01-23 23:06
    How about using two Stamps?

    One does all the IR stuff, the other just counts the time between the signal to send the IR message and the time the first one says "Okay, got it".

    [noparse][[/noparse]I haven't done anything like this - just speculating aloud, and waiting for the smarter/more experienced folks to step in]
Sign In or Register to comment.