9 years, 10 months ago.  This question has been closed. Reason: Unclear question

Ax12 hello world and motor ids. A small tiny help please.

So ive been trying out mbed with ax-12w. Ive been able to run the Ax 12 hello world. First of all ive set 2 motors id. Id 1 & id 2. So as you can see ive tried to declare the id "int CurrentID=1; int NewID=1;" in the program below and it seems that my motor with the id 1 is moving. But is this the correct way to declare an id in a program? My main objective is to control 2 motor in a single program. By declaring the id as stated in the program below, in which way can i declare the id 2 so that i can control 2 motors at a time. Can someone tell me how do i declare the proper way? Or if im right...How do i declare multiple motor id in a program. Your reply will be much appreciated. :D

#include "mbed.h"
#include "AX12.h"

int CurrentID=1;
int NewID=1;
int main() 
{

    AX12 myax12 (p9, p10, 1);

    while (1) 
    {
        myax12.SetGoal(0);    // go to 0 degrees
        wait (1.0);
        myax12.SetGoal(300);  // go to 300 degrees
        wait (1.0);
        myax12.SetGoal(150);
        wait (1.0);
    }
}  

You probably get a warning that those two ints are ignored, at least I don't see why it would do anything with it. If you look at the functions there is one to change the ID of a servo. The used ID is simply the third argument of the constructor ('1' in this code).

posted by Erik - 16 May 2014