Shifting operations might seem intuitive, but you have to be careful when
shifting signed values.
2
Although they look similar, binary operators aren’t
the same as Boolean operators. Boolean operators such as && and || don’t
operate on the bit level. They implement the rules of Boolean algebra.
3
Beginners are often afraid of bit operations, but there’s no reason to fear
them. Microcontrollers operate on a bit level, so you have to be able to make
the bits obey your will. It takes some training, but it’s not rocket science.
2.
http://en.wikipedia.org/wiki/Arithmetic_shift
3.
http://en.wikipedia.org/wiki/Boolean_algebra_%28logic%29
Appendix 2. Advanced Arduino Programming • 252
report erratum • discuss
www.it-ebooks.info