Hi Omar,

Use this library (works only for IRIS so far)

http://szte-wsn.cvs.sourceforge.net/viewvc/szte-wsn/tinyos/tos/lib/Atm128FastAdc/

and this sample application to sample the mic at 9 KHz.

http://szte-wsn.cvs.sourceforge.net/viewvc/szte-wsn/tinyos/apps/MicReadStreamTest/

Miklos

On Tue, Jun 29, 2010 at 2:08 PM, Omar Bouzid <o.m.bou...@newcastle.ac.uk> wrote:
> Hi all,
>
> I would really appreciate if someone can reply and guide me with this problem.
>
> Is it possible to modify the soundlocalizer example explained in Tinyos 
> programming book, chapter 13 so that it can sample the mic sensor 
> continuously?
>
> In fact, I tried to do it by putting the "Atm128AdcSingle.getData" command 
> inside a for loop and each time the event "Atm128AdcSingle.dataReady" is 
> signalled, the data will be added to a buffer as shown in the code below. 
> However, it does not work as I expected. It seems to be that, although I can 
> see that the "Atm128AdcSingle.getData" command is executed several times 
> depends on the buffer size, the event "Atm128AdcSingle.dataReady" is 
> signalled only once (I don't know why?).
>
> Pleas correct me if what I did is wrong.
>
> void Cont_Sample() {
>        for(i = 0; i < BUFFER_SIZE; ++i)
>                call Atm128AdcSingle.getData(call MicAdcChannel.getChannel(),
>                                 ATM128_ADC_VREF_OFF, FALSE,
>                                 ATM128_ADC_PRESCALE_32);
>                printf("Here is a ith value: %d\n", i);
>                printfflush();
> }
> /////////////
>
> async event void Atm128AdcSingle.dataReady(uint16_t data, bool precise) {
>   Add_DataToBuffer(data);
>  }
> ////////////
>
> void Add_DataToBuffer(uint16_t Mic_data){
>        MicRead[i] = Mic_data;
>        if (i == BUFFER_SIZE)
>        {
>                printf("last iteration value: %x\n", i);
>                printfflush();
>                post stopMicrophone();
>        }
> }
>
> BTW: I am using Tinyos-2.x, Micaz and mts300.
>
> I would be very grateful if someone can help.
>
> Thanks in advance,
> Omar
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to