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
The I2C data is almost always binary data, not a string. Therefor I don't like the example
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.
The I2C data is almost always binary data, not a string. Therefor I don't like the example 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.