Creating a move multiple motors function
Page 1 of 1

Author:  vectorx5000 [ Sat Apr 23, 2016 10:55 am ]
Post subject:  Creating a move multiple motors function

I am trying to create a function to move 2 motors with one function. Here is what I have currently:

void movemotors(string fport1,string fport2, int speed, int time){
   motor[fport1] = speed;
   motor[fport2] = speed;

the string fport 1 and 2 are strings to input the ports you want to move. Speed is speed, and time is time. When I run this, I get the error:
**Error**:'&' Invalid parameter for reference variable. Call to 'movemotors'. Parameter: 'unsigned string & fport1' is 'port1' of type 'tMotor'.
Is there a way to make this work properly so I can write with it?

Author:  CARBOT [ Thu Apr 28, 2016 9:36 pm ]
Post subject:  Re: Creating a move multiple motors function

What you are trying to do is indirectly address the motors. The motor command would select the motor in the complier with the alphanumeric name. You want it to use the alphanumeric after the program has compiled.

You may need a function for each pair of motors you want to run.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group