Go to Post What's this about a robot that they speak of? Are we supposed to build one???? - ryan_f [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 30-01-2006, 19:55
J. Stofflett's Avatar
J. Stofflett J. Stofflett is offline
Registered User
FRC #0123
 
Join Date: Oct 2001
Rookie Year: 1997
Location: Michigan
Posts: 43
J. Stofflett has a spectacular aura aboutJ. Stofflett has a spectacular aura aboutJ. Stofflett has a spectacular aura about
Using a switch with a victor

I know that the CIM motors must be attached to a victor we want to turn the motor on to a constant speed with a switch instead of using a joystick. I know we did it several years ago by changing the code but it was with the old controller that used BASIC. Can't remember how we did it any pointers would be greatly appreciated.
  #2   Spotlight this post!  
Unread 30-01-2006, 20:00
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 852
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Send a message via AIM to Cuog
Re: Using a switch with a victor

have an if statement in code that is something like:

if(p1_sw_trig == 1)
{
pwm04 = 255;
}
else
{
pwm04 = 127;
}

and then it will be on full speed or at neutral and still going through a victor
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.
  #3   Spotlight this post!  
Unread 30-01-2006, 20:02
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 103
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Re: Using a switch with a victor

Try something like this:
Code:
if(switch = open){
  if(motor speed < 255){
    motor speed += User_Acceleration;
  }
  if(switch = cosed){
    if(motor speed > 127){
      motor speed -= User_Acceleration;
    }
  }
}
Obviously this isn't copy and paste code, but I think you can figure it out from here. You want to increment the motor speed so that you don't add extra wear and tear on your gear/transmission box. If you want to reverse the motor, you need to add another conditional under each main condition.

Good luck.

**Props to Drew Shapiro (huge white kid with a 'fro) for comming up with this scheme.** - He doesn't like it when I steal his code.

Last edited by EricWilliams : 30-01-2006 at 20:09.
  #4   Spotlight this post!  
Unread 30-01-2006, 21:00
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: Using a switch with a victor

Try something like this:

pwm01 = 127 + (p1_sw_trig*127) - (p1_sw_top*127);

That way, if p1_sw_trig is pressed, the motor will be full forward (254). If p1_sw_top is pressed, it will go full reverse (0). If by mistake you press both buttons, nothing happens - safe!

Gotta love one liners
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
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
PRESSURE SWITCH Mr. Steve Pneumatics 20 01-12-2005 10:20
Victor 884 problem Gal Longin Control System 11 26-01-2005 00:47
LEDs in switch box. ZZII 527 Electrical 5 06-03-2004 19:39
Digital Inputs interfering with each other Bongle Programming 8 23-02-2004 11:18
Victor 884 Calibration Incorrect Just3D Electrical 4 15-02-2004 15:20


All times are GMT -5. The time now is 01:04.

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