View Single Post
  #1   Spotlight this post!  
Unread 14-02-2006, 21:45
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Motor drive function?

Lets say I want to have a function, that somehow modifies an inputted speed and sets an inputted motor to that speed. Instinct tells me it would be something similar to
Code:
void Drive(int motor, unsigned char speed)
{
	// modify inputted speed
	motor = speed;
}

Drive(pwm01, 100);
However, I've tried that and it doesn't seem to work. The motors just don't spin. I'm assuming it is because when you read pwm01, it gives you the current speed that pwm01 is running at. So Drive(pwm01, 100) is similar to, say, Drive(127, 100)

What is the cause of this problem? How can I fix it?
__________________
http://www.mikesorrenti.com/