I want to make speak two Arduino connect in I2C . I use a program to detect the address of one of my boards with the other. But I can't find it.
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println(F("\nI2C Scanner"));
}
void loop()
{
byte error, address;
int nDevices;
Serial.println(F("Scanning..."));
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println(F("No I2C devices found\n"));
else
Serial.println(F("done\n"));
delay(5000); // wait 5 seconds for next scan
}
With my arduino UNO, I see the connect but nothing from the connect
Your question is not particularly clear. Maybe it is a language issue.
Anyway, usually, an I2C network consists of one master and one (or more) slaves.
The code you have shown appears to be am I2C scanner running on a Uno (as master).
What other device is connected to the I2C pins of this Uno?
It is usually good to have pullup resistors (say 10k) on the SDA and SCL pins of the master.
I want to use two Arduino Nano Connect RP2040, one as slave the other as master. Connect is the name of the board
When I use the scan I see nothing from the two Arduino Connect boards. However when, I use the program on a UNO board I see the Nano Connect board, but the Nano Connect board don't see the UNO. I try the program on each boards.
I think my problem come from the Arduino Nano Connect board.
I already put two pull-up resistors of 1k, should I change to 10k ?
Be careful of mixing a Uno which is 5volts with a Nano RP2040 Connect board which is 3.3 volts and may not be tolerant of 5 volts.
So you are running a scanner software on one of the Nano RP2040 Connect boards. This makes it act as a master. What software are you running on the other Nano RP2040 Connect board to make it act as a slave ?
I would recommend 10k pullup resistors especially if you are mixing voltages. Or are you following instructions or a tutorial which specifies 1k resistors ?
Citation Is this the Nano RP2040 Connect board you are using:
That's is
Citation So you are running a scanner software on one of the Nano RP2040 Connect boards. This makes it act as a master. What software are you running on the other Nano RP2040 Connect board to make it act as a slave ?
I have none
CitationI would recommend 10k pullup resistors especially if you are mixing voltages. Or are you following instructions or a tutorial which specifies 1k resistors ?
I searched I2C circuits and I do the same. That's the first time I use I2C.