#31

No problem at all. Just happy I can share and give back to the community. Smile

#32

Sweet. Thanks.

#33

No problem Dave.

Hope it helps.

#34

Love the tutorial vid and that makes sense for specific animatronic things. However, and I apologize if I missed this in another thread, I was hoping to utilize the ADC ports to operate flex sensors in this sort of function:

http://www.instructables.com/id/Arduino-Wireless-Animatronic-Hand-1/

I tested it out with the Arduino and it does what I want it to do, I just dont know how to "map" in the script the adc flex sensor input to the real time output of servo control.

My hope is to use ADC 0-4 to control servos on D0-4 repsectively on the EZ-B4. The other issue I am having is using the MPU6050 variables to control servos as well.

I have some ability with circuits and assembly, but I have the programming skills equivalent to just learning that the strings on my shoes keep them on, next year I hope to learn to tie them...

Again I apologize if these question have been answered elsewhere.

#35

That's easy - if you know how to do it in complicated C++ Arduino, then you can certainly do it even easier in EZ-Builder Grin . Here's how...

1) Add a new EZ-Script control
- Project
- Add Control
- Scripting
- EZ-Script

2) Paste in this code

Code:


:loop

Servo(d0, getadc(adc0))
Servo(d1, getadc(adc1))
Servo(d2, getadc(adc2))
Servo(d3, getadc(adc3))
Servo(d4, getadc(adc4))

sleep(100)

goto(loop)



*Note: you may have to add a multiplier of sort to the GetADC() for each of the positions to dial in your accuracy. As you may have seen with your Arduino setup, the resister values on the flex sensor determine the accuracy and voltage being returned.

#36

Thank you DJ! I am very proficient with copy and paste Smile This makes me so happy, I've spent months reading how to books in arduino trying to figure out this I2c and wifi thing to no real avail. I can get the circuits to read right with meters but seldom get the code to operate correctly. (impatient with paying work getting in the way I guess), then I saw your creation and fell in love with it. A heartfelt thanks to you and your team.

What would the multiplier you speak of look like?

#37

@artchas... analog values are from 1 to 255...servo positions are from 1 to 180, so you would use a "multiplier" to convert them to a servo position... The multiplier in this case is 0.7058... You would multiply all your analog readings by .7058 and that would covert them to a servo position from 1 to 180....

Code:


:loop
$adc0= Round(getadc(adc0) *.7058,0)
$adc1= Round(getadc(adc1) *.7058,0)
$adc2= Round(getadc(adc3) *.7058,0)
$adc3= Round(getadc(adc3) *.7058,0)
$adc4= Round(getadc(adc4) *.7058,0)

Servo(d0, $adc0)
Servo(d1, $adc1)
Servo(d2, $adc2)
Servo(d3, $adc3)
Servo(d4, $adc4)

sleep(100)

goto(loop)

#38

Thank you Richard for the explanation!

So literally a mathematical function is in place. I see. Hypothetically I could then use this same concept to acquire and apply reading from a accelerometer for servo control as well?
I will look at the SC32 already in the EZB script and see how that is called for reading when I get time and see if I can figure that out. I am guessing I would need to use the add control function for the MPU6050, then set up a script that tells it to read that (similar to above with the exception that I would use the Hex address X or Y variables) and then assign that variable to a servo...? Am I in the ball park?

I see that the MMA7455 under I2C is already set to control servos in the settings. I will look at that too.

Thank you again