Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 6 months ago.
Ax12W motor hello world with a bit of changes. 2 motor simultaneously. Double loop?
So , Ive tried to run two motors in the program. It actually worked! Well my question is , how do i run both motor simultaneously in 2 loop. Im not so sure if its possible or maybe how do i run both at one time? any answer will be much appreciated!
#include "mbed.h" #include "AX12.h" int main() { AX12 m1(p9, p10,1); AX12 m2(p28, p27,2); while (1) { m1.SetGoal(0); // go to 0 degrees wait (1.0); m1.SetGoal(300); // go to 300 degrees wait (1.0); m1.SetGoal(150); wait (1.0); m2.SetGoal(0); // go to 0 degrees wait (1.0); m2.SetGoal(300); // go to 300 degrees wait (1.0); m2.SetGoal(150); wait (1.0); } }
Assigned to
10 years, 5 months ago.This means that the question has been accepted and is being worked on.
hi
Ax12 used serial interface ,the program will sends out a command packet ,which includes ID, instruction ,and AX-12 with the matching ID and send a packet to micro controller includes ID data and checksum .
so we can sent many command with different ID at onetime.
if you want 2 motor run same degrees both at one time , use Broadcasting ID (254)0XFE.
:)
posted by Gong Chen 23 Jun 2014