Offending Python Script......did i miss something........
# The Adafruit16CServoDriver API is supported through Jython
import math
servo1 = Runtime.createAndStart("servo1", "Servo")
servo2 = Runtime.createAndStart("servo2", "Servo")
servo3 = Runtime.createAndStart("servo3", "Servo")
servo4 = Runtime.createAndStart("servo4", "Servo")
servo5 = Runtime.createAndStart("servo5", "Servo")
pwm = Runtime.createAndStart("pwm", "Adafruit16CServoDriver")
pwm.connect("COM6")
# attach servo1 to pin 0 on the servo driver
pwm.attach(servo1, 1)
pwm.attach(servo2, 2)
pwm.attach(servo3, 3)
pwm.attach(servo4, 4)
pwm.attach(servo5, 5)
servo1.broadcastState()
def my_range(start, end, step):
while start <= end:
yield start
start += step
for pie in my_range(0, 2*3.142, .01):
pie2=math.sin(pie)*50+50
print(pie2)
servo1.moveTo(pie2+10)
servo2.moveTo(pie2+10)
servo3.moveTo(pie2+10)
servo4.moveTo(pie2+10)
servo5.moveTo(pie2+10)
Ahahha !
SCAREY !
First thing that comes to mind ... is Python's Scales !
Nope, not those scales... the scales of the methods you are calling.
In the past there were 2 Servo.moveTo() methods ... 1 took ints the other floats.. The float expected range was (if I remember correctly) -1 <---to---> 1
You can quickly find out if this is the issue by sending this to the servos
Servo.moveTo(int(pie2+10))
What I find strange is that this was changed many moons ago ... so mebbe if it still behaves like a slithering snake - we still have a mystery ...
If this does not immediately tame the beast - please send me a noWorky
Python looses its bite
Indeed the int() did the trick .... all is working fine .... Your Elves have spoilt my fun....
... now time to set different "Pi" length waves to each finger..... for full effect.....
BTW :- Sending the python script a second time whilst the first one is still controlling the servos sends them into frenzy mode .... guess its not such a good idea to send parallel codes!!!
Cheers GroG ...
MRL is massively
MRL is massively multi-threaded Finite State Machine
So you can apply as many parallel scripts to it as you would like too... And that's exactly what they will do - operate in parallel.
Some people found Speech irritating because it would do the same thing - and the simultaneous voices makes a disturbingly impressive output. A "blocking" method was created speakBlocking("hello") which serializes all the utterances into something a human can understand.
Hmmm... seems like it might be a good default behavior of the Python "execute" too..
Borg Voice
Once you get the pitch bending to work it could be fun to generate several speech renditions of the same phrase and have them all play at once to create that borg collective kind of voice. :)