Go to Post Students can learn to drive on whatever they give us. Ramps, carpet, grating, HDPE, lexan, diamond plate, regolith, other robots the driver station wall, referees, stairs, Dean, the bar, goals, the scorer's table, you name it, I've watched robots somehow manage to drive on it - Peter Matteson [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-12-2013, 02:16 PM
ArzaanK ArzaanK is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Mississauga, Ontario, Canada
Posts: 40
ArzaanK is an unknown quantity at this point
Reading Encoder Values from Net Console

Hello,

Earlier, my team wired up some encoders on our drive train for testing. I then wrote some code to bring up the number of encoder clicks. However, every time I open up Net Console, I get the output "Clicks: 0"

I'm wondering if this is a programming, or an electrical, or mechanical issue. My code is as follows. (I'm only going to include the code that relates to the encoders)


Code:
#include "WPILib.h" 

class RobotDemo : public SimpleRobot 
{ 
	
	Encoder *rightEncoder;
	
public: 
 RobotDemo() 
 { 
	 //Encoders 
	rightEncoder = new Encoder (3,4);
	rightEncoder->Start();
} 
 
void OperatorControl() 
 { 
     while (IsOperatorControl()){ 
		  //Encoders 
	          printf("Clicks: %d\n", rightEncoder->GetRaw());
		 Wait(0.05); 
     }
 }
The "rightEncoder" is the encoder on the right side of our drivetrain. I didn't include the drivetrain code, but when I move the right side of the robot, the printout is still "Clicks:0"

Are there any flaws with my code, or could it possibly be an electrical or a mechanical issue?

Any help is greatly appreciated.
__________________
Arzaan Khairulla
Programmer/Driver
2013 Greater Toronto Regional East Winners with 1114 and 2056
2013 Galileo Division
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:54 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi