It means the least significant bit is 1 (I hope u know the binary representations of 1, 2 and 4 are 001, 010 and 100 respectively). So value &2 means the second least significant bit is 1, value &4 means the third least significant bit is 1...so on...
On 4/4/07, Vasudha K <[EMAIL PROTECTED]> wrote:
Hi all, I m a Newbie working on telosb motes of Crossbow. Using TinyOS1.x I am working on a task how to detect the light sensor and a code from apps/sense. Here is the code, I cannot understand the meaning of the statement if (value &1) call Leds.yellowOn(); result_t display(uint16_t value) { if (value &1) call Leds.yellowOn(); else call Leds.yellowOff(); if (value &2) call Leds.greenOn(); else call Leds.greenOff(); if (value &4) call Leds.redOn(); else call Leds.redOff(); return SUCCESS; } Please help me out. Thanks Vasudha ------------------------------ No need to miss a message. Get email on-the-go <http://us.rd.yahoo.com/evt=43910/*http://mobile.yahoo.com/mail%0A> with Yahoo! Mail for Mobile. Get started.<http://us.rd.yahoo.com/evt=43910/*http://mobile.yahoo.com/mail%0A> _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help