Hi,
 
I'm using tinyos 1.x with the Cricket system, and I want to send a radio 
message from one mote to another. I only need to send one decimal digit, but I 
am having problems. I've tried going through the radio tutorials but don't 
understand them. I've also tried imitating the format of other messages that 
are being sent in the Cricket code, to no avail. 
 
All I need to do is make it so that, when prompted through the serial input 
with "P BE %d" the radio sends %d to another mote, which acts on it. Here are 
some examples of what I am trying:
 
 
else if (!strncmp("BE", pos+2, 2)) {                 
//**************************************************
    beacon_calldata->x = atoi(pos+4);
    beacon_calldata->y = 0;
    beacon_calldata->z = 0;
    beacon_calldata->temp = 0;
    beacon_calldata->tb = FALSE;
            
            call RadioControl.start();
            TOSH_uwait(2000); 
            call RadioSend.send(&beacon_call);
            
            
      }
 
 
 
 
  event TOS_MsgPtr RadioReceive.receive(TOS_MsgPtr data) {
    uint8_t i;
 
    int result = 0;
    int count = 0;
    //uint16_t FailedAttemptComp;
    //char OutputMsg[128];
 
 
else if (CricketConfig.run_mode == MODE_BEACON){
            
            struct CricketBeacon * beac = (struct CricketBeacon *)data->data;
            
            call Leds.greenToggle();      
            
            if(beac->x == '4')
                  {call Leds.redToggle();}
                  
                  
            if (beac->x ==    (int)(CricketConfig.spaceid[6]-48))   
//***********************************************
            {
                  call RadioControl.start();
                  TOSH_uwait(2000);
 
                  if (CricketConfig.run_mode == MODE_BEACON) 
                  {
                        while ( count < CricketConfig.max_beacon_number - 1)
                        {
                              atomic 
                              {
                                    ReadyToSend = 0;
                              }
                              if (ReadyToSend == 0) 
                              {
                                                                        // Send 
the  //location
                                    if (CricketConfig.use_temp_sensor) 
                                    {beacondata->temp = 
CricketConfig.local_temp;}
         
                                    beacondata->tb = readTestSwitch();
                                    result = call RadioSend.send(&beaconmsg);   
                                  
                                    if (result == SUCCESS)
                                    {
                                          break;
                                    }
                              }
                              count++;
                        }
                  }
                                                                                
          

            }
 
//    return SUCCESS;
      }
            
    return data;
  }

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

Reply via email to