Go Down

Topic: Sending Array with I2C (Read 42 times) previous topic - next topic

master_of_x2

Apr 17, 2019, 08:09 pm Last Edit: Apr 17, 2019, 08:10 pm by master_of_x2
Hello i want to send an Arry with I2c to an other Ardunio.
My Slave Code looks like this :

Code: [Select]

float I2cArray[4];
char I2cSende[4];
void requestEvent()

{
  I2cArray[0] = 1;
  I2cArray[1] =2 ;
  I2cArray[2] =3 ;
  I2cArray[3] = 780;
for(int i =0;i<4;i++)
{
  char Buff;
   dtostrf(I2cArray[i],7,2,Buff);
   I2cSende[i]=Buff;
}
 

for(int i=0;i<4;i++){
  Wire.write(&I2cSende[i],sizeof(I2cSende[i]));
}

But now i dont really know how to receive the Array again.

PaulS

Quote
My Slave Code looks like this :
You left out "Some of " from the beginning of that sentence. I won't leave it out of my response.

Some of what you need to do is...

Well, that's enough for now.

Post ALL of your code for both ends, and explain why you are sending floats as strings, and why the floats are all initialized with integral values.
The art of getting good answers lies in asking good questions.

Go Up