
goldenbot

Is it possible to read the RGB values from JD Humanoid's eyes. For example if all the eyes are bright RED then play a WAVE file.
I understand you can use the RGB Animator to set the eyes.
What would be the javascript or EZ-Script syntax to set one eye to bright red.
I2C.write(0xA0, ??) or I2CWrite(0,0xA0, 0xFF, 0x00, 0x00). Also How do you specify which of the 18 eyes? Or do you just assume 3 bytes times 18.
What would the javascript or EZ-Script syntax be to read the eye LEDs assuming you can read the values as well?
eg: I2C.read(0xA0, ??) Also when I try and print that it just says System.object[].
or I2CReadBinary( 0, 0xA0, 18, $RGBValues ) and print($RGBValues[0])
it would be easiest to simply get the name of the action by looking at the variable. You can find that I’m the settings tab of the rgb animator control.
There isn’t a published protocol definition for the eyes. However, you can piece it together from the source code: https://github.com/synthiam/E-64_RGB_Eyes
Edit:
I wouldn't recommend using EZ-Script for anything, specifically i2c. Additionally, even if you were to you'd have to use the Binary versions of the commands because you'd be writing binary data. Use the JavaScript of ARC, because it's 100 times faster (no joke).... and the i2c commands are much easier implemented.
Here's the protocol definition from https://github.com/synthiam/E-64_RGB_Eyes/blob/master/E-64%20Firmware/Src/4685%20-%20i2c%20Biped%20Eyes%20x%2018/main.c
Code:
However, be careful not to write to address 30, because that changes the i2c address in eeprom and possibly brick the unit.
Say if someone else wrote an RGB Annimation script and you want to act on it when it runs.
Perhaps as a future feature in the RGB Animator when writing each frame you could allow the option to save the RGB Eyes as an array eg: $RGBAnimatorEyes. Then someone could just reference that to get the values of each RGB LED of JD's eyes.
I also tried setting a variable name for the Current Frame in the RGB Animator but it does not seem to save the variable name.
After saving when I come back in it is blank again. Perhaps that is a bug. I am running ARC 2020.04.03.00.
I think I will avoid writing to I2C directly until I fully understand how it works. I assume if I always use 0xA0 as the address I can never write to 30 (0x1E) by mistake. Also thanks for the link to the c source code. So the index uses the first 5 bits and the each RGB uses 3 bits. G and B would always start with 0.
I also now notice in the RGB Animator there are only 8 intensity settings from 0 to 7 for each colour.
This has helped me to better understand how the LED Eyes work.