You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the I2C outputs of an Arduino R4 minima board to make it communicate with other boards. I notice that the Wire.end() function does not seem to work. I commonly use this instruction to alternately switch the Uno R4 board to a "master" controller and a "slave" controller. Is this an error on my part?
Below is the sketch I am using for my tests.
"master" controller
/* Test de fonctionnement du bus I2C Test d'envoi en controleur maitre de la carte uno R4.*/
#include<Wire.h>voidsetup() {
while (!Serial && millis() < 4000);
Serial.println("Demarrage");
Wire.begin(50);
}
voidloop() {
Wire.end();
Wire.begin();
Serial.println("Envoi d'un texte");
Wire.beginTransmission(52);
Wire.write("Test d'envoi en maitre");
Wire.endTransmission();
Wire.end();
Wire.begin(50);
/*Serial.println("Demande 6 caractères"); Wire.requestFrom(52, 6); // request 6 bytes from peripheral device #8 while (Wire.available()) { // peripheral may send less than requested char c = Wire.read(); // receive a byte as character Serial.print(c); // print the character }*/delay(10000);
}
"slave" controller
/* Test de fonctionnement du bus I2C Test de réception en controleur esclave de la carte Arduino Nano-Every.*/
#include<Wire.h>voidsetup() {
Serial.begin(115200);
Serial.println("Demarrage");
Wire.begin(52);
Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent);
}
voidloop() {
delay(100);
}
voidreceiveEvent(int howMany) {
Serial.print("Nombre d'octets : "); Serial.println(howMany);
while(Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
Serial.println();
}
voidrequestEvent() {
Wire.write("hello "); // respond with message of 6 bytes
}
The text was updated successfully, but these errors were encountered:
per1234
changed the title
Wire library with Arduino Uno R4 minimaWire.end() function does not seem to work
Oct 16, 2024
Hello, It seems that no one can answer me. However, I had already reported this problem on a previous version of the library in November 2023 (UNO R4 access to DS1307 only works if board is used as a master exclusively #180) and this problem had then been fixed. Perhaps this correction could be made to this library. Thank you for your answers.
I am using the I2C outputs of an Arduino R4 minima board to make it communicate with other boards. I notice that the
Wire.end()
function does not seem to work. I commonly use this instruction to alternately switch the Uno R4 board to a "master" controller and a "slave" controller. Is this an error on my part?Below is the sketch I am using for my tests.
"master" controller
"slave" controller
The text was updated successfully, but these errors were encountered: