Go to Post You can never have enough figurative language. - Travis Hoffman [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 15-02-2014, 20:31
Micah Chetrit's Avatar
Micah Chetrit Micah Chetrit is offline
Registered User
FRC #3276 (NSR)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New London - Spicer MN
Posts: 90
Micah Chetrit is on a distinguished road
Potentiometer

Hello,
Sorry to bug you again, but we are trying to use a potentiometer to set the speed of a motor, but for visualizing what is happening, we are temporarily using a servo in it's place. We wired a 10 turn pot to the analog module on the crio with the signal wire going to the sweeper pin on the pot.

When we move the pot it sets the servo to one of two positions, either fully rotated one way, or fully rotated the other, and it happens after a fraction of a turn from one endpoint on the pot. So if we are fully CCW on the pot the servo is in one position, if we move the pot about 1/16 of a rotation the servo moves to the opposite end. We tried two different pots to make sure it wasn't the pot, and they are both 10k ohms. I don't think I need to wire a resistor in series or anything like that, do I?

I tried using both the GetValue and the GetVoltage functions and have the same issue. Here is the code:
Code:
AnalogChannel *MainPot;
float PotValue;
int Temp;


MainPot= new AnalogChannel(1);
PotValue=Temp=0;


			Temp=MainPot->GetValue();
			PotValue=Temp;
			PotValue=PotValue/1000;
			Servo6->Set(PotValue);
I divided GetValue by 1000 because it is a value of 0-1000 (and the Set Servo is -1 to 1) if I understand it right. I used a temporary variable temp to make sure there was no conflict in changing variable types. When I used GetVoltage I divided by 5 because the voltage is 0-5. Is there something obvious I am missing?
Reply With Quote
 


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 12:12.

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