Thread: Encoder Code
View Single Post
  #1   Spotlight this post!  
Unread 13-02-2009, 15:31
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
Encoder Code

Includes the Encoder Header Files

Code:
#include "Encoder.h"
Declared the Encoder Variables

Code:
	// Declare Encoder Variables for Input
	Encoder *encoderMotor1;
	Encoder *encoderMotor2;
We plugged the into Digital Inputs 3,4 & 5,6

Code:
		// Encoders
		encoderMotor1 = new Encoder(3,4);
		encoderMotor2 = new Encoder(5,6);
Created a function in the Initialize Area to start the encoders

Code:
	void EncoderInit(void) {
		encoderMotor1.Start();
		encoderMotor2.Start();
	}
Lastly we decided to use the print function to get the encoder values in the debug console

Code:
		// Encoder printf
		printf("%d %d\n", encoderMotor1->Get(), encoderMotor2->Get());
We receive errors on the lines encoderMotor1.Start(); & encoderMotor2.Start();

Error: Request for member 'Start' in '((BuiltinDefaultCode*)this)->BuiltinDefaultCode::encoderMotor1', which is of non-class type 'Encoder*'

Error: Request for member 'Start' in '((BuiltinDefaultCode*)this)->BuiltinDefaultCode::encoderMotor2', which is of non-class type 'Encoder*'


Any help would be much appreciated... I probably just need another pair of eyes on the code.
Reply With Quote