Thread: Pointer to pwm
View Single Post
  #1   Spotlight this post!  
Unread 05-02-2008, 19:37
bronxbomber92 bronxbomber92 is offline
Registered User
FRC #1551 (Grapes of Wrath)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Naples
Posts: 75
bronxbomber92 is an unknown quantity at this point
Pointer to pwm

I just wanted to make sure this was safe to do.

Code:
typedef struct
{
     // stuff
     unsigned char* pwm;
} Motor;

void InitMotor( Motor* motor, unsigned char* pwm, /* more parameters */ )
{
     // stuff
     motor->pwm = pwm;
}

then if I want to change the motor speed
Motor myMotor; InitMotor( myMoter, pwm10 );
myMotor.pwm = 127; // set it to nuetral
Is that all right to do? I assume it is, but just want to make sure.

Thanks