[Tinyos-help] absolute timer
Roberto Pagliari
paglia.tinyos at gmail.com
Sat Dec 2 10:13:14 PST 2006
Hi All,
I tried to use absolute timer to substitute a common repeated timer. Below
there is the code but I do not understand why the event myClock.fired never
happens. Thank you
implementation {
tos_time_t next_time;
tos_time_t actual_time;
command result_t StdControl.init() {
call Leds.init();
call Leds.yellowOff(); call Leds.redOff(); call Leds.greenOff();
return SUCCESS;
}
command result_t StdControl.start() {
actual_time = call TimeUtil.create(0, call Time.getLow32());
next_time = call TimeUtil.add(actual_time, call TimeUtil.create(0,
PERIOD) );
call myClock.set(next_time);
return SUCCESS;
}
command result_t StdControl.stop() {
return SUCCESS;
}
event result_t myClock.fired() {
call Leds.greenOn();
actual_time = call TimeUtil.create(0, call Time.getLow32());
next_time = call TimeUtil.add(actual_time, call TimeUtil.create(0,
PERIOD) );
call myClock.set(next_time);
return SUCCESS;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20061202/f04fbd09/attachment.htm
More information about the Tinyos-help
mailing list