Go to Post Even worse, you could have a "Kiss the Paul" contest. I heard he squeals when you pick him up too. - AndyB [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 09-02-2008, 20:21
Chris1228 Chris1228 is offline
Registered User
FRC #1228
 
Join Date: Sep 2007
Location: Rahway, NJ
Posts: 22
Chris1228 will become famous soon enough
potentiometer programming help

Hey,
We are programming a potentiometer and are having difficulty. We are having difficulty getting our code to work. It was written in Easy C. Can anyone help??
  #2   Spotlight this post!  
Unread 09-02-2008, 20:24
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: potentiometer programming help

What specific problems are you encountering? Are you not getting readings or can't you compile your code? You may also want to post the portion of your code that is giving you diffculty. The more specific you are, the more help will you get.
  #3   Spotlight this post!  
Unread 09-02-2008, 21:30
Chris1228 Chris1228 is offline
Registered User
FRC #1228
 
Join Date: Sep 2007
Location: Rahway, NJ
Posts: 22
Chris1228 will become famous soon enough
Re: potentiometer programming help

This is the code i made
#include "Main.h"
void OperatorControl ( void )
{
int joy_y_port1;
int joy_x_port2;
unsigned char left_output;
unsigned char right_output;
int limit = 1;
int limit2 = 1;
unsigned int steering;
int pressure;
while ( 1 )
{
PrintToScreen ( "steering value before getting steering reading=%d\n" , (long)¬
steering ) ;
joy_y_port1 = GetOIAInput ( 1 , 2 ) ; // get joystick data
left_output = (( joy_y_port1 -127 ) +127) ; // drive motor
SetRelay ( 8 , 1 , -1 ) ; // send power to the compressor
pressure = GetDigitalInput ( 9 ) ; // get air pressure reading
while ( pressure >= 120 )
{
SetRelay ( 8 , 0 , -1 ) ;
break ; // return to driving
}
steering = GetAnalogInput ( 1 ) ; // read pot
joy_x_port2 = GetOIAInput ( 2 , 2 ) ; // get joystick data
if ( joy_x_port2 > 245 || joy_x_port2 < 10 ) // if pushed hard left or right
{
right_output = (( joy_x_port2 - 127 )/2 +127) ; // use joystick over r¬
ide
}
if ( steering >663 ) // correcting towards the left
{
SetPWM ( 3 , 139 ) ;
PrintToScreen ( "this steering value should be above 512=%d\n" , (long)¬
steering ) ;
}
if ( steering <= 308 ) // correcting towards the right
{
SetPWM ( 3 , 115 ) ;
PrintToScreen ( "this steering value should be below 512 =%d\n" , (long¬
)steering ) ;
}
SetPWM ( 1 , left_output ) ;
SetPWM ( 2 , left_output ) ;
SetPWM ( 3 , right_output ) ;
OIToRelay ( 1 , 1 , 2 , 1 ) ;
}
}




I get readings from the device but it doesn't work the way i want it to. The purpose it to keep a solo wheel pointed directly outward and when the wheel is turned to the right with the joystick i want the pot sensor to recenter the wheel when we let go of the joystick and vice versa for the right.
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
Help wiring potentiometer-to-Analog port kylehager Electrical 4 17-01-2008 17:28
PLEASE HELP!! Need help programming arm?? amirjpl Programming 12 15-03-2007 15:11
Potentiometer help Unholy Programming 4 07-02-2006 17:48
Potentiometer Help! thoughtful Programming 4 18-02-2005 08:21
Potentiometer Question, we need help! dez250 Electrical 13 25-08-2004 14:50


All times are GMT -5. The time now is 02:58.

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