[Tinyos-help] Problems with readToneDetector()
Jorge Grande
jorgegrande at gmail.com
Fri Apr 20 02:47:45 PDT 2007
Hi Phil,
Sorry for not having replied before, I've been away a couple of weeks.
When there is a tone, thee LED toggles too, that's why I don't know what's
happening.
Thank you very much for your help.
Regards,
Jorge
On 4/3/07, Philip Levis <pal at cs.stanford.edu> wrote:
>
> On Mar 28, 2007, at 2:38 AM, Jorge Grande wrote:
>
> > Hello everybody,
> >
> > I'm using TinyOS 2.0 and I'm trying to write an application for two
> > micaz motes using the microphone. One of the two motes (mote 1)
> > will beep each 1000 ms and the other one (mote 2), once it has
> > detected the tone, will toggle the green led (if it doesn't detect
> > the tone, it will turn one the red led). This mote checks every 50
> > ms if the tone has been detected; I'm using command startPeriodic
> > including in tos/lib/timer and command readToneDetector including
> > in tos/sensorboards/mts300/MicSetting.nc.
> >
> > Here is part of the mote 2 application:
> >
> > ...
> >
> > event void Timer.fired() {
> > if (call MicSetting.readToneDetector() == 0) //tone has been
> > detected
> > {call Leds.led1Toggle();}
> > else // tone has not been detected
> > {call Leds.led0On();}
> > }
> >
> >
> > async event error_t MicSetting.toneDetected() {
> > return SUCCESS;
> > }
> >
> > ...
> >
> >
> > The problem is that mote 2 is continuously toggling the green led,
> > even if mote 1 is not beeping but I don't know why.
> >
> > Can anyone help me?
> >
>
> I'd email the folks who wrote the drivers; I'm not sure they all
> ready tinyos-help regularly. It looks like the driver is just
> checking an interrupt line when it does this test. Looking at the
> code, it seems like it just returns 1 when the line is high and 0
> when it's low... which suggests that the documentation of the return
> value is incorrect. Does the LED toggle when there is a tone, or does
> it stop toggling?
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20070420/0e5d744e/attachment.htm
More information about the Tinyos-help
mailing list