linking basics - hex instead of ascii for wire.write command

OK I'm using Wire.h

Late last night I was getting I2C responses to master working as the host uses 0D as stop command.

Now when writing code I get error in verification of expected initializer before "." token if use specifier byte command

If dont specify byte then I get unable to find numeric literal operator "operator""D"

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {

I would actually like to write in code as hex since it is written to line anyway as hex and I am confirming with protocol analyzer my results.

Try 0x0D

Yahoo - I'm back in business - that's what happens when not documenting late at night.



When you start a numeric value with a 0, the compile understands that you mean base 8. D is not a valid base 8 value. Hence, the compiler is confused. Rather than call you an idiot, it shows a cryptic message (we know what it means!).

HEX values are defined by the 0x prefix. Of course, the Wire.write() function does NOT require that any specific value be in HEX notation.

When there are two arguments to the write() method, the second one defines how much data to write. Writing 0x0D bytes of the 8 you specified doesn't make sense, so you have more than one problem.