Probably stupid question, but how do i send a byte "lets say" 100 times, without 100lines?
I have a slice of code which goes like this:
Wire.beginTransmission(0x3C);
Wire.write(0xE0);
Wire.write(0xF0);
Wire.write(0x08);
Wire.write(0x00); // Send this x100
Wire.sendTransmission();
When i try - Wire.write(0x00, 100); - I just get a garbled result...
Any bright ideas?
You can use a for loop. But the Wire library has a buffer that is only (IIRC) 32 bytes long and will just return an error without transmitting anything. You would have to edit Wire.h and increase the buffer size. In fact, you have to edit two files to increase the size:
...\hardware\arduino\avr\libraries\Wire\src\Wire.h and ...\hardware\arduino\avr\libraries\Wire\src\utility\twi.h
Pete
Genious!
Tested the code below, and it actually worked
Confirmed with my Logic Analyzer as well.
Maybe the <i2c_t3.h> has a bigger buffer?
Thanks alot nonetheless!
Wire.beginTransmission(0x3C);
Wire.write(0xE0);
Wire.write(0xF0);
Wire.write(0x08);
for (int x = 0; x < 100; x++) {
Wire.write(0x00);
}
Wire.sendTransmission();
i2c_t3.h doesn't use the buffer defined in the Wire library. It uses its own which is defined to be 259 bytes.
Pete