Go to Post What I’m trying to say is that you should not necessarily be looking to build the next “cool” thing, unless that’s your team’s goal and you’ve got the resources to finish it by ship date. - Bill Gold [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-02-2005, 15:25
incognito_NICK's Avatar
incognito_NICK incognito_NICK is offline
hidden in the corner
AKA: Nick Ferreira
#0179 (Children of the swamp (swampthing))
Team Role: Programmer
 
Join Date: Nov 2004
Rookie Year: 2002
Location: palm beach gardens
Posts: 15
incognito_NICK will become famous soon enough
Send a message via ICQ to incognito_NICK Send a message via AIM to incognito_NICK
Question coding a potentiometer

I am trying to look at the values i get with a potentiometer through the dashboard, but my attempts are ending in failure.
So is there some special code that have to put in so that i can read it or is it because i have it plugged in the wrong spot.
anyone know the solution?

  #2   Spotlight this post!  
Unread 12-02-2005, 15:35
Leav's Avatar
Leav Leav is offline
Spud Gun Division
AKA: Leav Oz-Ari
FRC #3316 (D-Bug)
Team Role: Mentor
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Technion, Haifa, Israel
Posts: 774
Leav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond repute
Send a message via ICQ to Leav Send a message via AIM to Leav Send a message via MSN to Leav
Re: coding a potentiometer

Quote:
Originally Posted by incognito_NICK
I am trying to look at the values i get with a potentiometer through the dashboard, but my attempts are ending in failure.
So is there some special code that have to put in so that i can read it or is it because i have it plugged in the wrong spot.
anyone know the solution?

on your pot you should have 3 pins, i blieve that the two outer ones should be connected to the + and - pins of the analog inputs and the middle one to the signal pin. (not infront of the robot right now...)

once you do that use this code: (assuming you connected it to analog input #1)
Code:
pot1=Get_Analog_Value(rc_ana_in01);
printf("pot1=%d \r ",pot1);
i'm not sure if you can read the analog inputs with the dashboard....
-Leav
__________________
"We choose to build robots this season and do the other things; Not because they are easy, but because they are hard."
-Paraphrasing JFK

Participated in FIRST as a student: 2005-2006 (But still learning every season!)
Mentor: 2008 - ? (Team 2630 2008-2011, and Team 3316 since 2013)
Engineer: 2011 - ? (B.Sc. and M.Sc. in Mech. Eng. from the Technion IIT)
FIRST Volunteer - 2007 - ? (MC, FTA, FIRST Aid etc.)
  #3   Spotlight this post!  
Unread 12-02-2005, 15:53
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: coding a potentiometer

Do you have to pot attached to the OI or attached to the RC?
You could have a wiring problem with the pot in either place, so double check the OI or RC specs for correct wiring.

The dashboard display for the OI comes setup to show the joystick port pot values as a range from 0-254.

For the RC dashboard screen you'll have to scale the pot (0-1023) to the range (0-255) and set one of the User_Byte's (1-6) to that value.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #4   Spotlight this post!  
Unread 12-02-2005, 23:05
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: coding a potentiometer

Quote:
Originally Posted by Mark McLeod
For the RC dashboard screen you'll have to scale the pot (0-1023) to the range (0-255) and set one of the User_Byte's (1-6) to that value.
Or use two user bytes:
Code:
    User_Byte1 = value >> 8;
    User_Byte2 = value & 255;
  #5   Spotlight this post!  
Unread 12-02-2005, 23:28
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: coding a potentiometer

Just bitshift it twice (from a 10 bit to an 8 bit number)
Code:
POT = Get_Analog_Value(rc_ana_in01) >> 2;
__________________
http://www.mikesorrenti.com/
  #6   Spotlight this post!  
Unread 14-02-2005, 15:56
incognito_NICK's Avatar
incognito_NICK incognito_NICK is offline
hidden in the corner
AKA: Nick Ferreira
#0179 (Children of the swamp (swampthing))
Team Role: Programmer
 
Join Date: Nov 2004
Rookie Year: 2002
Location: palm beach gardens
Posts: 15
incognito_NICK will become famous soon enough
Send a message via ICQ to incognito_NICK Send a message via AIM to incognito_NICK
thanks, that situation has been taken care off. appreciate greatly.
Closed Thread


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
PHP Coding HELP!!! FRANK(WGH) Website Design/Showcase 9 26-01-2005 17:18
Potentiometer Joshua May Technical Discussion 8 22-05-2004 19:51
Potentiometer with BS2 sanddrag Programming 7 13-05-2004 19:21
Coding / Style Standards for sharing C code Joe Johnson Programming 33 01-05-2004 15:15
Potentiometer Problem Greg General Forum 1 15-02-2003 18:10


All times are GMT -5. The time now is 23:56.

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