[Tinyos-help] counting the duration of a pulse

2015-01-24 Thread Bello Kontagora
Hi everyone, please can anyone help me out? I want to get the duration of an echo pulse through gpio/input pin. I interfaced PING ultrasonic range finder with XM1000(TelosB) through GPIO pin. the sensor requires a pulse of 5micro seconds to trigger it, it then returns an echo whose duration I neede

Re: [Tinyos-help] counting the duration of a pulse

2015-01-25 Thread András Bíró
Hi, The simplest way is probably LocalTimeMicroC, e.g.: uint32_t time; atomic{ //you don't want interrupts to mess up with the timing call samplePin.makeOutput(); //make the pin an output call samplePin.set(); //start ranging call delay.wait (5); //for 5 micro seconds call samplePin.clr()