Lego Mindstorms EV3 Basic – Built-In Support for I2C Communications and UART

So what's this EV3 Basic, anyway?


Built-In Support for I2C Communications and UART

What is I2C? I²C (Inter-Integrated Circuit), pronounced I-squared-C, is a multi-master, multi-slave, single-ended, serial computer bus. It is typically used for attaching lower-speed peripheral ICs to processors and microcontrollers. Alternatively I²C is spelled I2C or IIC.  It is a 2 line (plus common ground) communication method for one master device to control up to 112 slave devices.

What is UART? A universal asynchronous receiver/transmitter, abbreviated UART /ˈjuːɑrt/, is a computer hardware device that translates data between parallel and serial forms. The data format and transmission speeds are configurable. A UART is usually an individual (or part of an) integrated circuit (IC) used for serial communications over a computer or peripheral device serial port. UARTs are now commonly included in microcontrollers.

The I2C method in EV3 Basic

Let's dig into the I2C method introduced in EV3 Basic as part of the Sensor library:

Sensor.CommunicateI2C (port, address, writebytes, readbytes, writedata)
Communicates with devices using the I2C protocol over one of the sensor ports. This command addresses one device on the I2C-bus and can send and receive multiple bytes. This feature could be used to attach a custom sensor or to communicate with any device that is capable to be connected to the I2C bus as a slave.

port  Number of the sensor port

address  Address (0 - 127) of the I2C slave on the I2C bus

writebytes  Number of bytes to write to the slave (maximum 31).

readbytes  Number of bytes to request from the slave (maximum 32, minimum 1).

writedata  Array holding the data bytes to be sent (starting at 0).

Returns  An array holding the requested number of values. Index starts at 0.


Read more about the Sensor object in EV3 Basic.  



Dig Deeper on Lego Mindstorms:

Lego Mindstorms EV3 extension for Small Basic - EV3 Basic!!!

Program your Lego Mindstorms EV3 Robots with actual Text-Based Coding!

FREE SOFTWARE: Lego Mindstorms EV3 Basic for Small Basic

Lego Mindstorms EV3 Basic - Small Basic is in 20 Languages!!!

Lego Mindstorms - EV3 Basic is the Easiest Installation!!

Lego Mindstorms EV3 Basic - Small Basic teaches you as you type!

Lego Mindstorms EV3 Basic - What are the social collaboration features?

Lego Mindstorms EV3 Basic - Leveraging the Small Basic Graphics Window

Lego Mindstorms EV3 Basic - SPECIAL FEATURES: the Sound & Speaker Objects

Lego Mindstorms Development - Get better handling of Variables!!!

Lego Mindstorms EV3 Basic - Unlock the Power of Text!!!!


Have a Small and Basic day!

   - Ninja Ed


Comments (6)
  1. Hi Ed

    Have you ever got Sensor.CommunicateI2C() to work? I am trying to use it with a Mindsensors EV3 Sensor Mux and it does not work

    It does not seem to honour the Address parameter.

    I wrote a test program to display the data from 0-127 in lines of 16 bytes and it does not give the expected results.


    1. No, I haven’t tried it with Mindsensors. Please contact the EV3 Basic team on their site:


    2. Tom Zuppel says:

      Hi David!
      Did you finally get the Mindsensors EV3 Sensor Mux to work with EV3Basic?
      Which Address parameters did you use exactly?
      Could you send me your code-Files?
      I’m trying to create a small library for my students to get the Mux to work, but I’m still pretty unsuccessful.

  2. Bosco Cervantes says:

    Hey there,
    I want to use a Color Sensor from the EV3 with a PIC do you know how can i do that? PLEASE HELP! It is for a proyect from the school

    1. Please contact the EV3 Basic team on their site:


Comments are closed.

Skip to main content