I am using MAXE2 , can anyone provide me code to run more than one motion ?
like now if I write :
motion.play(5)
motion.wait()
it says hello , but I want to add the motion 9,10 as well. How can I write that ? I tried to write them in next line but it only performed the motion 5.
What is your programming environment? On the CM-550 or on some other SBC?
Can you share your code?
Or try to re-download the whole Motion Group to include Motion 9 and 10
First, next time, put your code inside the “Formatted Text” tool
It will preserve the indentations and comments, so that others can read your code easily like below:
from pycm import *
console(BLE)
rpi.mode(2)
motion.play(1)
motion.wait()
while True:
x = rpi.position_x() # face detection x coordinate
# if the face is detected the x value is greater than 0
if x > 0:
print("found")
# play scale #20 for 0.1 seconds
buzzer.note(20, 100)
buzzer.wait( )
delay(100)
motion.play(5)
motion.wait()
# adding motions 9 and 10 - basically you need to wait for each motion to finish
# before you can start another one.
motion.play(9)
motion.wait()
motion.play(10)
motion.wait()
# PYCM also has an alternative syntax if you need to run 2 motions, one right after the other
motion.play(9, 10)
motion.wait()
# see link https://emanual.robotis.com/docs/en/edu/pycm/#motion
# if the start button was pressed for 2 second
if button. seconds() == 2:
# change to standby mode
rpi.mode(0)
#end the loop
break
great it works, but not working in a loop like it always need my face to do actions. I was training it for walk like once he detect the human face it start walking. for that i was using motion 70. how to make the loop ? like it sees human face once and keep walking until i give any other command ? like i also used mic.counting function instead of rpi so robot start doing motion on my clap like now I am trying to make it walk on my face detection using while loop and stop as I clap ?