Problem with Arduino with EV3


#1

Hello,

i have read enteriely the tuto : https://www.dexterindustries.com/howto/connecting-ev3-arduino/
and after several test, nothing are working…
I have the breadboard adapter for lego and Arduino Uno.
I wanted to send a data from my arduino to EV3’s screen.

But nothing happenned.

here is the Arduino code :

#include <Wire.h>
#define SLAVE_ADDRESS 0x04
void setup()
{
    Serial.begin(9600); // start serial for output
    Wire.begin(SLAVE_ADDRESS);
    Wire.onReceive(receiveData);
    Wire.onRequest(sendData);
    Serial.println("Ready!");
}
int val,flag=0;
void loop()
{
  if(flag==1)
   {
     Serial.print(val);
     flag=0;
   }
}
void receiveData(int byteCount)
{
    while(Wire.available()>0)
    {
      val=Wire.read();
      flag=1;
    }
}
// callback for sending data
void sendData()
{
  Wire.write(0x45);
}

and here the Mindstorms program :
read_1_byte