wire only sending device address

Hi There,

Using the standard wire example (master_writer), my nano board will only transmit the device address.

Looking at the signal with a scope, I can see the device address and the expected delay before the next write. Regardless of what I do, I cant seem to get the data to write!

Any suggestions, I must be doing something silly as this is a standard library.

#include <Wire.h>

void setup() {
Wire.begin(); // join i2c bus (address optional for master)
}

byte x = 0;

void loop() {
Wire.beginTransmission(8); // transmit to device #8
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting

x++;
delay(500);
}

Read number 7 about code tags here : http://forum.arduino.cc/index.php/topic,148850.0.html

If you changed something to the examples, then please post both the Master and Slave code.

Give links to special modules or sketches. For example this is a link: https://www.arduino.cc/en/Tutorial/MasterWriter

The I2C data is almost always binary data, not a string. Therefor I don't like the example :frowning:

If there is no Slave, the Master did not get an acknowledge for address and stops the I2C transmission. You need to have a working Slave to see the data on the I2C bus.
Perhaps something wrong with the hardware ?
The first step is to have a working Slave, and run the i2c_scanner in the Master : Arduino Playground - I2cScanner
You may keep the i2c_scanner running while trying to connect the wires properly.

Did you know that the Arduino IDE can be started more than once ?
That way it is possible to have the Master (with serial monitor) on one side of the screen, and the Slave (with its own serial monitor) on the other side of the screen.

Thanks for the reply, I'll hook up a slave and see what happens. Will post the results here.

Read number 7 about code tags here : http://forum.arduino.cc/index.php/topic,148850.0.html
thanks, will do this next time

If you changed something to the examples, then please post both the Master and Slave code.
No changes were made to the code.

Give links to special modules or sketches. For example this is a link: https://www.arduino.cc/en/Tutorial/MasterWriter
thanks, will do this next time

The I2C data is almost always binary data, not a string. Therefor I don't like the example :frowning:
Agreed, my code was setup to write bytes but I wanted to check the example code to see if it had similar problems.

If there is no Slave, the Master did not get an acknowledge for address and stops the I2C transmission. You need to have a working Slave to see the data on the I2C bus.
Perhaps something wrong with the hardware ?
The first step is to have a working Slave, and run the i2c_scanner in the Master : Arduino Playground - I2cScanner
You may keep the i2c_scanner running while trying to connect the wires properly.
I think this makes the most sense. I didn't expect the library to comply with the ack but if it is complying with the ack then this may be expected behavior. I'll setup a slave and repeat my tests.

Did you know that the Arduino IDE can be started more than once ?
That way it is possible to have the Master (with serial monitor) on one side of the screen, and the Slave (with its own serial monitor) on the other side of the screen.

Thanks, will give this a try.