Wire.write() Sanity Check

Hi All,

I'm trying to send an unsigned long via Wire.write() from a slave to a master and it refuses to work for me. I can send a string and write() nicely sends each byte over the wire. As well, write() deals with unsigned ints just fine. However when I try to send anything larger than 256 (well, 255) it treats it as an unsigned int. I checked the TWI base and it looks like there's a specific overload for unsigned ints, but I can't get it to work. Am I missing something obvious?

Here's a quick example of what I'm talking about:

Wire.write((unsigned long) 25512)  //just a random number, and it fails with or without the cast

will give me this when I try to pull the number from the slave

I2C>[0x4d rrrrrr]
I2C START BIT
WRITE: 0x4D ACK
READ: 0xA8
READ:  ACK 0xFF
READ:  ACK 0xFF
READ:  ACK 0xFF
READ:  ACK 0xFF
READ:  ACK 0xFF
NACK
I2C STOP BIT
I2C>

I've also tried sending an unsigned long via a variable an no joy. Thanks for looking!!

an unsigned long is 4 (count them, four) bytes....

now look at the reference page for the wire library

ARGH. My apologies, I was looking at the definitions for LiquidCrystal_I2C.write.

TheMonkeyStink: ARGH. My apologies, I was looking at the definitions for LiquidCrystal_I2C.write.

it happens...

;)