Thread: Encoder Code
View Single Post
  #1   Spotlight this post!  
Unread 13-02-2009, 15:40
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Encoder Code

Quote:
Originally Posted by dboisvert View Post
Code:
		// Encoders
		encoderMotor1 = new Encoder(3,4);
		encoderMotor2 = new Encoder(5,6);
Code:
	void EncoderInit(void) {
		encoderMotor1.Start();
		encoderMotor2.Start();
	}
We receive errors on the lines encoderMotor1.Start(); & encoderMotor2.Start();
Your encoderMotorN variables are pointers to Encoder objects. The C++ "dot" syntax is used with objects themselves; use the "->" syntax instead when working with object pointers, like this:
Code:
	void EncoderInit(void) {
		encoderMotor1->Start();
		encoderMotor2->Start();
	}
Doesn't the Get() method return a float? The %d format specifier in your printf() is probably going to be an issue.
Reply With Quote