LamiRene:
Bonjour Artouste,Bon, les valeurs côté Mega semblent bonnes avec ton code !
Alors, là, faut donc comprendre qu'il y a une gestion interne plus ou moins invisible (transparente) du nombre d'octets a envoyer ?
Y-a une explication ?
L'ami René
il y a evidemment une explication
mais je n'ai pas le courage de chercher pour l'instant
juste pour test essaye ceci (sender) pour verifier qq points
#include "Wire.h"
// Adresse de la communication I2C de l'Arduino Mega avec Nano.
const byte ADRESSE_NANO_1 = 1;// Adresse requise pour l'esclave Tiny i2c.
byte Variable_X = 0;
byte Variable_Y = 0;
byte Variable_Z = 0;
byte Varsend[10] = {0, 0, 0, 30,40,50,60,70,80,100};
void EnvoyerDonnees ()
{
Variable_X = Variable_X + 1;
Variable_Y = Variable_Y + 2;
Variable_Z = Variable_Z + 3;
Varsend[0]=Variable_X;
Varsend[1]=Variable_Y;
Varsend[2]=Variable_Z;
//Wire.write (Variable_X);
//Wire.write (Variable_Y);
//Wire.write (Variable_Z);
Wire.write (Varsend,10);
// Écriture dans le moniteur série de l'IDE d'Arduino des valeurs lues.
Serial.print (", Variable_X = ");
Serial.print (Variable_X);
Serial.print (", Variable_Y = ");
Serial.print (Variable_Y);
Serial.print (", Variable_Z = ");
Serial.print (Variable_Z);
Serial.println ();
}
void setup ()
{
Serial.begin (115200);
Serial.print ("* Debut setup Nano *");
Serial.println ();
// Joindre le bus I2C.
Wire.begin (ADRESSE_NANO_1);
// Enregistrer l'événement pour lorsqu'une demande arrive.
Wire.onRequest (EnvoyerDonnees);
Serial.print ("* Fin setup Nano *");
Serial.println ();
Serial.print ("* Debut loop Nano *");
Serial.println ();
Serial.println ();
}
void loop ()
{
}