Hi;
i'm newbie at sensor nodes. I am trying  to send a message and receive it. 
Until now i edit examples. I tried this send, receive applications in this 
examples. This is my first implementation without starting from an example. I 
install this program to two nodes. Ones  has  timer, it sends a message every 1 
minute and it toggles red led in sendDone function. I see the red led toggling. 
The other mote receive this message.When receive this message, it must toggle 
green led. But it  doesn't do that. 
i am sending codes, too. For the receiver node  i comment "call 
Timer.start(TIMER_REPEAT,1000);" line; so that its timer doesn't work. We must 
do this immediately for undergraduate project. After this we will implement a 
routing algorithm. Please reply ASAP.

Parent.nc File:
includes deneme;

configuration Parent {
}
implementation {
    components Main, ParentM, GenericComm, LedsC, TimerC;
    Main.StdControl -> ParentM.StdControl;
    ParentM.Send -> GenericComm.SendMsg[AM_INTMSG];
    ParentM.Receive -> GenericComm.ReceiveMsg[AM_INTMSG];
      ParentM.SubControl -> GenericComm;
      ParentM.Leds -> LedsC;
      ParentM.Timer -> TimerC.Timer[unique("Timer")];
}

ParentM.nc:
includes deneme;
module ParentM {
    provides {
        interface StdControl;
    }
    uses{
        interface StdControl as SubControl;
        interface SendMsg as Send;
        interface ReceiveMsg as Receive;
        interface Leds;
        interface Timer;
    }
}
implementation {
    uint16_t cost = 6;
    uint16_t parent;
    TOS_Msg tempMsg;
    command result_t StdControl.init() {
        call Leds.init();
        call Leds.redOff();
        call Leds.yellowOff();
        call Leds.greenOff();
        call SubControl.init();
        return SUCCESS;
    }
    command result_t StdControl.start() {
        call Timer.start(TIMER_REPEAT,1000);    //comment this line for 
receiving node
        return SUCCESS;
    }

    command result_t StdControl.stop() {
        return SUCCESS;
    }
    event TOS_MsgPtr Receive.receive(TOS_MsgPtr m) {
        call Leds.greenToggle();
         return m;
      }
      event result_t Send.sendDone(TOS_MsgPtr msg, result_t success)
      {
        call Leds.redToggle();
        return SUCCESS;
      } 
      event result_t Timer.fired()
      {
          IntMsg *message = (IntMsg *)tempMsg.data;
              message->val = 5;
    atomic 
    {
          message->src = TOS_LOCAL_ADDRESS;
    }
          call Send.send(TOS_BCAST_ADDR,sizeof(IntMsg),&tempMsg);
        return SUCCESS;
      }
}
deneme.h file:

typedef struct IntMsg {
  uint16_t val;
  uint16_t src;
} IntMsg;

enum {
  AM_INTMSG = 4
};






      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today 
http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to