Arduino and EV3 connection - not connected

ev3
arduino

#1

Good day,
Sorry for my weak English. I bought the Breadboard Adapter for LEGO Mindstorms. I used the engagement: https://www.dexterindustries.com/howto/connecting-ev3-arduino/

But I do not get any answer. EV3 will not show anything. I made a loop in EV3 in order to write continuous data to the Arduino. The k value is empty in receiveData(). Communication is not possible.
I need to send the sensor data to EV3.
Please help. I am a beginner.
My code arduino:

#include <Wire.h>
#define SLAVE_ADDRESS 0x04
Int = 0, flag = 0;

Void setup ()
{
    Serial.begin (9600); // start serial for output
    Serial.println ("Arduino SLAVE, LEGO master"); // show OK
    Wire.begin (SLAVE_ADDRESS);
    Wire.onReceive (received);
    Serial.println (val); // show OK
    Serial.println (flag); // show OK
    Wire.onRequest (sendData);
    Serial.println ( "prepared"); // show OK
}

Void loop ()
{
    if (flag == 1)
   {
     Serial.print (val);
     flag = 0;
   }
 // else {Serial.print ("flag 0");} // show OK
}

Void receiveData ()
{
    Int k = Wire.available ();
    Serial.print ( "to");
    Serial.println (a); // notshow FALSE
    while (Wire.available ()> 0)
    {
      val = Wire.read ();
      flag = 1;
    }
}
// callback for sending data
Void sendData ()
{
    Wire.write (0x45);
    Wire.write (48);
}

My EV3: Brick HW V0.60; Brick FW: V1.09E

Thank you very much.
Johny


#2

Few things to try:

  1. I2C Lines reversed. You may want to try to reverse the I2C lines.
  2. You may also need to add extra pullup resistors.

Your best bet is to put a logic analyzer on the two I2C lines, and take a screenshot of the output. There could be a few things going on that preventing the I2C data transmission.


#3

Well thank you. I’ll try. :grinning:


#4

Hello everyone!I had the same problem here, nothing was working. The small yellow switches near the cable port caused the problem. I turned them down and now everything is working!