Shop OBEX P1 Docs P2 Docs Learn Events
Isolating bytes with an xbee. — Parallax Forums

Isolating bytes with an xbee.

Is there any possible way to isolate an 8 bit packet on the receive side of an xbee?

for example,
If xbee.rx << 8 (ex. 00101101, ignoring anything less than 8 bytes.)
MainButtons := xbee.rx

Comments

  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-11-15 23:19
    Do you mean isolate an individual bit or bits within a byte (or word or long)? To get a single bit (0 or 1), you can use this method.
    pub get_bit(value, bitpos)
    
      return (value >> bitpos) & 1
    
Sign In or Register to comment.