You haven't included the part of your program where 'msg' is declared,
so it's hard to say exactly why the compiler is whining...

The problem with packet is that variables can only be declared at the
beginning of code blocks in C and Nesc. A code block is surrounded by
{ } braces, so declarations are usually put at the beginning of
the function.

In answer to your audio recording question, search this list for
audio, microphone, and similar key words. I sent some links, maybe
last month, that didn't seem to help much but could provide guidance.

MS


MUNEERA A. ALBABTAIN wrote:
> Hello again,,
> 
> I have been trying to do my own acoustic ranger application with micaz motes 
> (mts310CA sensorboard).
> 
> I have three nodes:
> Node1: only sends an RF packet to node2 and buzz the sounder at the same time.
> Node2: Receives the RF packet sent from node1 and increments a counter ( with 
> a timer) until it detects the buzzer sound to calculate the distance between 
> the two motes, then it will send a data packet to the baseStation node with 
> the counter.
> BaseStation node (Node0): receives the data packet from node2 and displays 
> the counter value.
> 
> I'm having a problem with node 2 when I compile the program, the error 
> details are the following:
> mune...@muneera-vaio:~/tos/tinyos-2.x/apps/AcousticRanger/ToneDetector$ make 
> micaz
> mkdir -p build/micaz
>     compiling ToneDetectorAppC to a micaz binary
> ncc -o build/micaz/main.exe  -Os -DATM128_I2C_EXTERNAL_PULLDOWN=1 
> -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=micaz 
> -fnesc-cfile=build/micaz/app.c -board=mts300 -DDEFINED_TOS_AM_GROUP=0x22 
> --param max-inline-insns-single=100000 -DIDENT_APPNAME=\"ToneDetectorApp\" 
> -DIDENT_USERNAME=\"muneera\" -DIDENT_HOSTNAME=\"muneera-vaio\" 
> -DIDENT_USERHASH=0xfb432861L -DIDENT_TIMESTAMP=0x4cb2d7fdL 
> -DIDENT_UIDHASH=0x0fb961f5L -fnesc-dump=wiring 
> -fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs, 
> components)' -fnesc-dumpfile=build/micaz/wiring-check.xml ToneDetectorAppC.nc 
> -lm
> In file included from ToneDetectorAppC.nc:13:
> In component `ToneDetectorC':
> ToneDetectorC.nc:40: warning: declaration of `msg' shadows global declaration
> ToneDetectorC.nc:24: warning: location of shadowed declaration
> ToneDetectorC.nc: In function `MicSetting.toneDetected':
> ToneDetectorC.nc:55: syntax error before `*'
> ToneDetectorC.nc:56: `packet' undeclared (first use in this function)
> ToneDetectorC.nc:56: (Each undeclared identifier is reported only once
> ToneDetectorC.nc:56: for each function it appears in.)
> 
> 
> --------------------------------------------------------
> 
> The MicSetting.toneDetected function:
> async event error_t MicSetting.toneDetected() {
> 
>                 // Stuff to do when tone detected
>                 call Timer0.stop();
>                 call Leds.led1Toggle();
>                 datamsg_t* packet = (datamsg_t*)(call 
> DataPacket.getPayload(&msg, sizeof(datamsg_t)));
>                 packet-> nodeID = TOS_NODE_ID;
>                 packet-> counter = counterT;
>                 call DataSend.send(0, &msg, sizeof(datamsg_t));
> 
> 
>                 return SUCCESS;
>         }
> 
> ----------------------------------------------------------------
> The header file:
> #ifndef SENSORMSG_H
> #define SENSORMSG_H
> 
> enum{
>         AM_DATAMSG = 6,
> };
> 
> 
> typedef nx_struct datamsg{
>         nx_uint8_t nodeID;
>         nx_uint16_t counter;
> 
> }datamsg_t;
> 
> 
> #endif
> 
> ------------------------------------------------------------------
> 
> I'm sure that the noteDetection works fine the led toggles, also I have 
> included the header file in both configuration and module files.
> 
> I don't know where the problem is exactly!
> 
> I really appreciate your help and thank you in advance
> 
> 
> Best Regards,
> 
> 
> Muneera A. Albabtain
> Researcher
> 
> Disclaimer: This message and its attachment, if any, are confidential and may 
> contain legally privileged information. If you are not the intended 
> recipient, please contact the sender immediately and delete the  message and 
> its attachment, if any. You should not copy the message or disclose its 
> contents to any other person or use it for any purpose. Statements and 
> opinions expressed in this e-mail are those of the sender, and do not 
> necessarily reflect those of King Abdulaziz city for Science and Technology  
> (KACST). KACST accepts no liability for damage caused by this email.
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to