![robotc robotc](http://botbench.com/blog/wp-content/uploads/2014/04/featured-robotc-ev3-preview.png)
The device being controlled is referred to as the slave. The master ( always the NXT) always controls the communications, and always sets the communications clock for both devices. The other wire is for sending data (data is sent and received by both devices at the same time), and is usually referred to as “ SDA“. The clock line is usually referred to as “ SCL“. One wire provides a clock: this makes sure that both devices are sending information at the same speed. I2C is called a “two wire interface”, because it uses two wires to communicate. Both are very similar, but different.Ī little background on I2C and the NXT.
Robotc how to#
In this example, we show you how to send commands to the Arduino from the NXT and how to write a program that requests data from the Arduino. Although it’s beyond this tutorial, with clever coding and polling, the Arduino can be setup to control the NXT. The NXT must always be a master and can never be a slave. In this tutorial, we setup the Arduino as an I2C slave, and the NXT as an I2C master. The NXT and the Arduino can be made to talk over I2C. This is probably the fastest way to free your NXT and add your own sensors and devices: when you connect the NXT and the Arduino and the world is yours!
![robotc robotc](https://docplayer.net/docs-images/25/6137192/images/20-0.png)
This example can be extended to use the Arduino as a sensor for the NXT, and to develop your own sensors for the LEGO MINDSTORMS NXT system.
![robotc robotc](https://image.slidesharecdn.com/introtorobotc1-130320232643-phpapp02/95/intro-to-robotc-2-638.jpg)
In the demonstration, we use an Arduino Uno, but the example we’ve written can be used for just about any of the versions of Arduino. In this HowTo, we’ll show you how to get your LEGO MINDSTORMS NXT and your Arduino to talk.