Re: 回复: [Tinyos-help] Problem with TinyOS2-x tutorial lesson 3, BlinkToRadio telosb led is not blinking

nisha jain jain61 at gmail.com
Mon Jan 14 19:10:01 PST 2008


Hi Sam,

I am having two motes for this application.
But after programming each one none of the led is glowing.

Regards,
Nisha

On 1/14/08, Renee Azhen <azhen_renee at yahoo.com.cn> wrote:
>
> Two motes are needed.
> each one send signal to the other, then they can flash the leds.
>
> Sam
>
> *nisha jain <jain61 at gmail.com>* 写道:
>
>  Hi All,
>
> I have used code BlinkToRadio for mote communication.
>
> After programming the motes the led is not blinking
>
> Please let me know what is the problem.
>
> Following is the BlinkToRadioC.nc file
>
>  #include <Timer.h>
> #include "BlinkToRadio.h"
> module BlinkToRadioC {
>   uses interface Boot;
>   uses interface Leds;
>   uses interface Timer<TMilli> as Timer0;
>   uses interface Packet;
>   uses interface AMPacket;
>   uses interface AMSend;
>   uses interface Receive;
>   uses interface SplitControl as AMControl;
> }
> implementation {
>   uint16_t counter;
>   message_t pkt;
>   bool busy = FALSE;
>     event void Boot.booted() {
>     call AMControl.start();
>   }
>   event void AMControl.startDone(error_t err) {
>     if (err == SUCCESS) {
>       call Timer0.startPeriodic(TIMER_PERIOD_MILLI);
>    }
>    else {
>      call AMControl.start();
>    }
>  }
>  event void AMControl.stopDone(error_t err) {
>  }
>  event void Timer0.fired() {
>    counter++;
>    if (!busy) {
>      BlinkToRadioMsg* btrpkt =
>       (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL));
>      btrpkt->nodeid = TOS_NODE_ID;
>      btrpkt->counter = counter;
>      if (call AMSend.send(AM_BROADCAST_ADDR,
>          &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS) {
>        busy = TRUE;
>      }
>    }
>  }
>  event void AMSend.sendDone(message_t* msg, error_t err) {
>    if (&pkt == msg) {
>      busy = FALSE;
>    }
>  }
>  event message_t* Receive.receive(message_t* msg, void* payload, uint8_t l
>    if (len == sizeof(BlinkToRadioMsg)) {
>      BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)payload;
>      call Leds.set(btrpkt->counter);
>    }
>    return msg;
>  }
> }
>
>
>  Regards,
> Nisha
>
>
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>  ------------------------------
> 雅虎邮箱传递新年祝福,个性贺卡送亲朋!<http://cn.mail.yahoo.com/gc/index.html?entry=5&souce=mail_mailletter_tagline>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080114/695ec1c4/attachment.htm


More information about the Tinyos-help mailing list