You may need to start GenericComm...put this in the start() and see;
call SubControl.start()
Otherwise it looks like it ought to work. When you were using the
canned examples you had working radio communication, right? If not
then you may need to check all the make options for channel and
transmit strength.
MS
orcun ertugrul wrote:
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! Answers - Got a question? Someone out there knows the answer. Try
it now
<http://uk.answers.yahoo.com/;_ylc=X3oDMTEydmViNG02BF9TAzIxMTQ3MTcxOTAEc2VjA21haWwEc2xrA3RhZ2xpbmU>.
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help