Hi all,
Recently I have been doing some simple experiment in Imote2.I want to send the 
data from one mote to another,which was defined in my local C file(not from the 
sensor) .The interface I use are SendMsg and ReceiveMsg.When the Timer 
fired,the data would be sent.If the message is sent successfully,the green 
indicator will flash.
------------------------------------------------------------------------------------------
event result_t Timer.fired(){
    uint16_t j,k;
    struct ProcessnodeMsg *pack;     
    while(startPos < MAX_BUFFER)        //The variable starPos was first 
assigned to 0 in the global space;
    {
             k = 0;
             pack = (struct ProcessnodeMsg *)msg[currentMsg].data;   
             for(j = startPos;j<startPos+BUFFER_SIZE&&j<MAX_BUFFER;j++)
             {
                 pack->data[k] = (uint8_t)inputdata[k]; //inputdata[256][256] 
was defined in 'inputfile.h'
                 k++;
             }
             pack->sourceMoteID = TOS_LOCAL_ADDRESS;
             pack->sequenceNum = ++seqNum;  
             post dataTask();
             if(startPos>=MAX_BUFFER)
                 startPos = 0;
             else
                 startPos = j;
        }
     call Leds.greenToggle();
     return SUCCESS;
    }
}
-------------------------------------------------------------------------------------------
task void dataTask() {
    //Try to send the packet.
    if (call DataMsg.send(TOS_BCAST_ADDR, sizeof(struct ProcessnodeMsg),
                  &msg[currentMsg]))
      {
        atomic {
          currentMsg ^= 0x1;
        }
        call Leds.yellowToggle();
      }
  }
--------------------------------------------------------------------------------------------
But when I compile the code into Imote2 ,it doesn't work!

I don't know what the problem is.Could someone help me?


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

Reply via email to