Send to a Friend

gorillapaws's avatar

C++/Arduino programmers, can you help me understand this line of code?

I’m just starting to dip my little toe into arduinos and maybe some hobbyist robotics. I was looking at the driver for an Arduino device and I came across the following line:

#define RPLIDAR_RESP_MEASUREMENT_SYNCBIT (0×1<<0)

then there’s:

#define RPLIDAR_RESP_MEASUREMENT_CHECKBIT (0×1<<0)

If you’re doing a left bit-shift by a value of 0, what’s the point? why not just define it as “0×1”? This is a driver, so they’re defining the response from the device. It just seems very counter intuitive. I suspect that there is an important concept underlying that code that I don’t understand and since I’m not sure what that is, I’m not sure what keywords I should be searching to figure it out.

Any help would be greatly appreciated.

Topics: , , , ,

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.

Mobile | Desktop


Send Feedback   

`