Go to Post "Defense wins qualifying rounds, offense wins championships." - Paul Copioli [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 18-02-2005, 15:19
caderader's Avatar
caderader caderader is offline
caderader
#1284 (DART)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: gville
Posts: 19
caderader is an unknown quantity at this point
Exclamation Problems programming a switch

I am trying to make our arm work on a switch(one position is up one for down and one for neutral) so far i have not successfully been able to get the switch to work the arm. At first i thought the code might be similar to the 1 joystick code but its not. We are using a motor like the one that is on the drivetrain to power it. Does anyone know how i could do this.
Thanks!
  #2   Spotlight this post!  
Unread 18-02-2005, 15:49
caderader's Avatar
caderader caderader is offline
caderader
#1284 (DART)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: gville
Posts: 19
caderader is an unknown quantity at this point
Re: Problems programming a switch

I am trying to get this switch when flipped up to run a pwm at full speed (255?) when flipped to the middle to run it at neutral(127) and when flipped all the way down to run it in full reverse(0) does anyone have idea how i could code this.
Thanks again
Cade
  #3   Spotlight this post!  
Unread 18-02-2005, 22:06
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: Problems programming a switch

Connect the common of the switch to ground on the OI, the "up" contact to p4_sw_aux1, and the "down" contact to p4_sw_aux2. Assuming the arm motor is on pwm3, your code would look like this:
Code:
    if (p4_sw_aux1 == 1)
      pwm3 = 254;
    else if (p4_sw_aux2 == 1)
      pwm3 = 0;
    else
      pwm3 = 127;
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
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
Programming Sub-Team Problems Phil Paspalas Programming 9 19-01-2005 21:42
Problems and questions about programming hedgehogger Programming 4 15-01-2005 18:18
3 way toggle switch programming LeadRiccardoT Programming 3 17-02-2003 02:02
Error found in programming for the pump and pressure switch sjharobotics Programming 4 06-02-2002 17:46


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

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