Go to Post And let's face it their junk is our robot! - jrgrim12 [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
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 24-01-2002, 15:35
punarhero's Avatar
punarhero punarhero is offline
Registered User
#0696 (Clark Magnet Robotics)
Team Role: Programmer
 
Join Date: Jan 2002
Location: la crescenta
Posts: 67
punarhero is an unknown quantity at this point
Send a message via AIM to punarhero Send a message via Yahoo to punarhero
speed change

Hi,
What change should I make to my PBASIC default code to manifulate how fast a motor goes from 127 to 0, or from 127 to 254.
Thanx
  #2   Spotlight this post!  
Unread 24-01-2002, 17:24
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,631
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Faster != Possible

If you want to make the motor go faster, you are out of luck.

If you want to make it go slower, you just have to reduce the distance away from 127 to make the voltage to the motor less.

Code below (untested off the top of my head so it may have bugs, but I think it is good to go). Also, I have resigned myself to the fact that pbasic has a certain order of operations and that that order is not the order you and I normally use. Some folks use parenthesis to try to fix this problem. The intent is to make matters clear to the reader, but in fact, in the case of pbasic, they make matters UNCLEAR, so I use them as little as I can. I am much happier this way. You should try it. It is okay... ...really.

Pbasic Zen Master,

Joe J.



MotorPWM Var Byte
ScaleNum CON 4
ScaleDen CON 4
'Total scalefactor = ScaleNum / 2^ScaleDen
'Example above Scalefactor = 0.25 or 25%

'Set MotorPWM as usual

if MotorPWM < 127 ScaleReverse
ForwardScale:
MotorPWM = MotorPWM - 127 * ScaleNum >> ScaleDen + 127 MAX 254
goto ScaleDone
ScaleReverse:
MotorPWM = 127 - (127 - MotorPWM * ScaleNum >> ScaleDen MAX 127)
ScaleDone:

'continue coding...

'if you want to have an adustable "gas" you can replace ScaleNum with a variable (p1_wheel for example) Joe J
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
"Automatic Transmission" Madison Technical Discussion 70 24-11-2003 09:03
Beantown Blitz game change? Erin Rapacki Off-Season Events 31 18-06-2003 12:39
Power, speed, and torque... AGH Gui Cavalcanti Technical Discussion 5 10-11-2002 19:02
How many posters does it take to change a lightbulb? Brandon Martus Chit-Chat 7 22-02-2002 19:48
Calibrating speed controllers and joysticks thedillybar Technical Discussion 4 11-02-2002 13:24


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

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