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
needed. below is my code section: thank you in advance.

      (PingingP.nc)
























*module PingingP @safe() {    uses {                interface Boot;
        interface Leds;                interface HplMsp430GeneralIO as
samplePin;                interface BusyWait<TMicro, uint16_t> as delay;
            interface Timer<TMilli> as Timer;    }}    implementation {
    uint16_t Time;    event void Boot.booted() {        call
Timer.startPeriodic(2000);}    event void Timer.fired () {        call
Leds.led1Toggle();        call samplePin.makeOutput(); //make the pin an
output        call samplePin.set(); //start ranging        call delay.wait
(5); //for 5 micro seconds        call samplePin.makeInput(); // make the
pin an input        Time = call samplePin.get(); //this is where am
confused, how to get the duration of the echo pulse and print it?
printf("Time is %d\n", Time);    }}*

        (PingingC.nc)
#include <Timer.h>

configuration BuzzerC {
}
    implementation {
        components MainC, BuzzerP as App, LedsC;
        MainC.Boot <- App;
        App.indication3 -> HplMsp430GeneralIOC.Port26; //pin4 of the 6 pins
expansion
        App.Leds -> LedsC;
        components HplMsp430GeneralIOC;
        components BusyWaitMicroC;
        App.delay -> BusyWaitMicroC;
        components SerialPrintfC;

        components new TimerMilliC() as Timer;
        App.Timer -> Timer;

}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to