
OldBotBuilder

DJ, Anybody,
Is there new information about I2C? The last reference I can find is:
http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=322
I am trying to write a script that will have the EZ-B v4 respond as an I2C slave to a master I2C device. To do this, the master device sends the EZ-B data, the EZ-b is then able to respond by sending data to the master.
The script fails and the WiFi connection is broken.
I have to power down, then reconnect the EZ-B.
Here is a script snippet:
(The address of the master is 0x4)
>> The master is in a loop I2C writing a '1', then I2C reading <<
:loop
$V1 = I2CRead(0,0x4,1)
Print ("V1 = "+$V1)
I2CWrite(0,0x4,40) #decimal 40 is the value I want written
sleep(1000)
goto(loop)
Thank you.
Attempting to read i2c will pause forever (as you are experiencing) without knowing there is data. Do something like this...
1) Send a request for data
2) Read the known data size that has been requested
Code:
Thanks for the quick reply.
Your script is setting the EZ-b as the master and the BlinkM as the slave.
I need the EZ-b to be the slave.
I have connected the EV3 via an arduino and got it to work with the information in http://www.dexterindustries.com/howto/connecting-ev3-arduino/
Near the end is a section headed "EV3 as the Master".
BTW-
http://www.ez-robot.com/Community/Forum/Thread?threadId=6532 shows the robot that I wish to 'enhance' with all the super EZ-B capabilities.
A video is at: https://www.youtube.com/watch?v=DiGyeV759JE
Again, thanks.
You could essentially run your robot with 2 masters. The ez-bv4 can communicate serially to the Arduino. You could write a program on the Arduino that could translate your serial data from the ez-b and create I2C commands to send to the EV3 controller, probably wouldn't be that efficient but it's an idea.
Otherwise, I would suggest to try interfacing the motors and sensors from the EV3 directly to the ez-b. I believe LEGO peripherals also communicate as I2C slaves, but I don't have enough info on these new LEGO kits to confirm that.
My thoughts are you would either need to use an Arduino in between the two. Or it might be possible to communicate with the LEGO EV3 over wifi using TCP/IP.
This might work.
Good ideas and I will look into both suggestions.
Thanks to you both.
Now - how does the 'resolved by' credit get assigned?