Go to Post "Recycle Rush? What's that, some sort of charity marathon?" - Chak [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 18-02-2010, 08:29
whatabouteve whatabouteve is offline
Registered User
AKA: Dean Keithly
FRC #0245 (Adambots)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rochester Hills,MI
Posts: 45
whatabouteve is an unknown quantity at this point
potentiometer/ analog inputs

We are having trouble getting our potentiometer code to work.

we declare it
AnalogInput *potemtiometer;


later
potentiometer = new AnalogInput(2);

and we can't figure out the last part. We don't have anything to go off of because last year was an easy 1,2,3 robot.
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2010, 09:04
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
Re: potentiometer/ analog inputs

try using AnalogChannel instead of input
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2010, 09:54
whatabouteve whatabouteve is offline
Registered User
AKA: Dean Keithly
FRC #0245 (Adambots)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rochester Hills,MI
Posts: 45
whatabouteve is an unknown quantity at this point
Re: potentiometer/ analog inputs

okay we'll try that.
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2010, 15:58
whatabouteve whatabouteve is offline
Registered User
AKA: Dean Keithly
FRC #0245 (Adambots)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rochester Hills,MI
Posts: 45
whatabouteve is an unknown quantity at this point
Re: potentiometer/ analog inputs

attempting analog channel didn't work when we added

float anglesh = pot1.GetVoltage();
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2010, 16:49
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: potentiometer/ analog inputs

shouldn't it be pot1->GetVoltage();?
Reply With Quote
  #6   Spotlight this post!  
Unread 18-02-2010, 18:41
whatabouteve whatabouteve is offline
Registered User
AKA: Dean Keithly
FRC #0245 (Adambots)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rochester Hills,MI
Posts: 45
whatabouteve is an unknown quantity at this point
Re: potentiometer/ analog inputs

i'm trying to make the code right and it compiles but we'll see if i get something.

i haven't actually had a potentiometer until now.
Reply With Quote
  #7   Spotlight this post!  
Unread 18-02-2010, 22:40
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
Re: potentiometer/ analog inputs

1075guy is right, because you declared it using a pointer you must use -> instead of .
Reply With Quote
  #8   Spotlight this post!  
Unread 19-02-2010, 15:06
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: potentiometer/ analog inputs

use pot1->GetValue() for a 0-1023 range value, pot1->GetVoltage() for 0.0-5.0 range. Try both and see which one you like better
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #9   Spotlight this post!  
Unread 20-02-2010, 21:40
whatabouteve whatabouteve is offline
Registered User
AKA: Dean Keithly
FRC #0245 (Adambots)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rochester Hills,MI
Posts: 45
whatabouteve is an unknown quantity at this point
Re: potentiometer/ analog inputs

i try printing the values to the screen and i get really big values sometimes. Why would this be? is it because i might run the loops they are in too quuickly. i set them to .02 seconds and i think its doing better.

I actually disabled the watchdog for the autonomous because it won't run through long waits in the system. this worked until just now when it started giving me watchdog not fed errors that have never happened before.
Reply With Quote
  #10   Spotlight this post!  
Unread 21-02-2010, 00:45
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: potentiometer/ analog inputs

Quote:
Originally Posted by whatabouteve View Post
i try printing the values to the screen and i get really big values sometimes. Why would this be?
Perhaps there's a digit or two left over on the screen from a previous print step? For example, if one value is 1003 and the next one is 996, it might end up on screen looking like 9963 if you aren't careful.
Reply With Quote
  #11   Spotlight this post!  
Unread 21-02-2010, 09:11
whatabouteve whatabouteve is offline
Registered User
AKA: Dean Keithly
FRC #0245 (Adambots)
Team Role: Leadership
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Rochester Hills,MI
Posts: 45
whatabouteve is an unknown quantity at this point
Re: potentiometer/ analog inputs

this could be i will try to fix this.
would printing

printf(" =angletop");
printf("%d",angletop);

would this work in the correct format assuming it prints on line 1 and the %d writes over it?
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Analog Inputs!! brennerator Programming 7 11-02-2007 15:48
Analog Inputs bush Programming 5 13-03-2006 17:49
Analog Inputs prob. Bharat Nain Programming 2 07-02-2004 20:48
Failing analog inputs? Phasmatis568 Control System 5 22-01-2004 13:28
Analog Inputs 316_programer Technical Discussion 2 05-02-2002 05:53


All times are GMT -5. The time now is 14:18.

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