OldBotBuilder
USA
Asked
— Edited
Resolved by Jeremie!
DJ, Anybody,
Is there new information about I2C? The last reference I can find is: https://synthiam.com/Community/Questions/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.
You are unable to "read" unless there is a request sent.
Attempting to read i2c will pause forever (as you are experiencing) without knowing there is data. Do something like this...
Send a request for data
Read the known data size that has been requested
For more information, look at the i2c BlinkM example...
DJ,
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.
The EZ-B is unable to be a slave - it's configured as a master by factory.
I am trying to use the EZ-b as a 'capability enhancer' for robots built with the Lego EV3. To do this the EV3 uses a Dexter Industries I2C sensor block. This block sets the EV3 as the I2C master.
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- https://synthiam.com/Community/Questions/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.
Hi @OldbotBuilder,
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.
From what I read, it looks like the EV3 can only be a Master (no slave option) and the EZB as DJ said likewise is designed to only be a Master.
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.
Jeremie and JustinRatliff,
Good ideas and I will look into both suggestions. Thanks to you both.
Now - how does the 'resolved by' credit get assigned?