Hi,
Im trying to send a uint16_t Value to a raspberry Pi over I2C using Python.
Im sending it like this:
void I2cBigWrite(uint16_t bigVal) {
digitalWrite(P1LED, HIGH); // set the LED on
bigVal = 1000;
Wire.write (lowByte (bigVal));
Wire.write (highByte (bigVal));
digitalWrite(P1LED, LOW); // set the LED on
}
and receiving it like this:
def readTacho1(self):
freq = i2cbus.read_word_data(dev_address, 0xE)
print freq
Pretty simple.
But what I receive is 33768. The arduino is sending the lowByte first, then the highByte.
If I split the reading into two bytes:
def readTacho1(self):
freq1 = i2cbus.read_byte_data(dev_address, 0xE)
freq2 = i2cbus.read_byte(dev_address)
print "First Byte: " + str(freq1)
print "Second Byte: " + str(freq2)
I get:
First Byte: 232
Second Byte: 232
It looks like it is only receiving the (first) lowByte.
....
Do I miss something? :o