Main Content

Cannot Connect to a Sensor or Motor

When you try to connect from the MATLAB® software to a sensor or motor, the Command Window displays an error. When you use the MATLAB software to get data from a sensor or motor, the Command Window displays unexpected values.

To resolve this issue, first complete the steps in Cannot Connect to the EV3 Brick.

Then, perform each of the following steps.

  1. Check that sensors are connected to the EV3 input ports, labelled 1, 2, 3, or 4. Check that motors are connected to the EV3 output ports, labelled A, B, C, and D.

  2. If you add or change a connection to a sensor or motor, shut down and restart the EV3 brick to ensure that it performs a hardware detection routine.

  3. Verify that the sensor appears in the ConnectedSensors property of the EV3 brick. For example:

    myev3 = legoev3
    
    myev3 = 
    
      legoev3 with properties:
    
          FirmwareVersion: 'V1.03E'
               HardwareID: []
                IPAddress: []
        CommunicationType: 'USB'
             BatteryLevel: 100
         ConnectedSensors: {'touch'  'infrared'  'color'  'sonic'}
  4. If more than one sensor of the same type is present, specify the input port the sensor uses. For example:

    myirsensor = irSensor(myev3,2)
    myirsensor = 
    
      irSensor with properties:
    
          Channel: 1
        InputPort: 2