Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by DJ Sures!

I2c Read

When I try to follow the scripting for I2C read it says to enter the information like as follows
$val = I2CRead(0, 0x68, 1). now when I do this I get an error that I need to enter 4 values and that that I entered only 3.
second thing is I am trying to read values from an accelerometer (mpu 6050) how do i read from a specific register rather than the 7 bit device address.
any help would be appreciated. Thanks


Upgrade to ARC Pro

Get access to the latest features and updates with ARC Pro edition. You'll have everything that's needed to unleash your robot's potential!

That EZ-Script command seems to have snuck through our last test before the release *blush* . It will be resolved in tomorrow's release

As for how to read from a register, you can look at any of the i2c examples in the Examples folder of ARC. This link will help you find the example projects and how to use them: http://www.ez-robot.com/Tutorials/Help.aspx?id=1002

Here's a hint:)

The way i2c works is you must first write to the register that you wish to read. Once you've written to the register, that tells the device that you wish to read from it. So your next command is to read.

So you would do something like this


# prepare 0x68 register for reading
i2cWrite(0, 0x20, 0x68)

# expect 2 bytes
$value = i2cRead(0, 0x20, 2)
Do you ever sleep, lol probably to busy working day and night to bring us all these updates and answers to our questions. thank you for the quick reply and hint to get me moving along.:D