View unanswered posts | View active topics It is currently Sun May 19, 2013 3:28 am






Reply to topic  [ 3 posts ] 
How to define...? 
Author Message
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 509
Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
Post How to define...?
I'm using the Hi-Technic IR-Link to control 6 motors, and want to assign a name to each one so that I don't have to remember the channel and port their on. An example command:

Code:
PFMotor(PneumSwtch, (ePWMMotorCommand)7);//with name.
PFMotor(pfmotor_S1_C1_A, (ePWMMotorCommand)7);//without name.

I've tried, but I really have no idea what to do. I think I would use #define, but I don't know how. Can anyone help me?

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Fri Feb 17, 2012 11:10 am
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 2858
Location: Rotterdam, The Netherlands
Post Re: How to define...?
You could declare it like this:
Code:
tPFmotor PneumSwtch = pfmotor_S2_C1_A;
PFMotor(PneumSwtch, MOTOR_FWD_PWM_7);

I haven't tested this. In fact, I had completely forgotten that you could even do this with my IRLink driver, haha. I had to look at the code to see how it worked :)

- Xander

_________________
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)

| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Feb 17, 2012 11:18 am
Profile WWW
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 509
Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
Post Re: How to define...?
mightor wrote:
You could declare it like this:
Code:
tPFmotor PneumSwtch = pfmotor_S2_C1_A;
PFMotor(PneumSwtch, MOTOR_FWD_PWM_7);

I haven't tested this. In fact, I had completely forgotten that you could even do this with my IRLink driver, haha. I had to look at the code to see how it worked :)

- Xander


Thank you!!! Works perfectly!!!

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Fri Feb 17, 2012 11:50 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.