Go to Post I'm not worried about the amount of Segways at a regoinal, I'd rather see them out in the real world than at a robotics competition. - Joe Matt [more]
Home
Go Back   Chief Delphi > Old Forum Archives > 2001
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Something to be said for readable code...

Posted by Nate Smith at 2/15/2001 12:02 PM EST


Other on team #66, Frostbite, from Willow Run High School and GM Powertrain.


In Reply to: Re: EVEN MORE PBASIC HELP, ASAP!!
Posted by Stephen on 2/14/2001 10:15 PM EST:



: I recomend you not make PWM1(or any PWM) a variable. It just, simply put, wastes those 26 variables. Just go to the serout command, and where PWM1 is, just put p1_y. This also works for other things, I'll give you one more example. We have a servo, that will be 156 when nothing is pressed (closed position), and 10 when p1_sw_top is pressed (open position), instead of wasting a variable and putting an again wasteful if loop in, I just went to the serout command, and at PWM4 wrote
: ((p1_sw_top ^ 1)*146)+10

While I agree that in some cases, it is easiest to just put the variable(in the case of PWM1 = p1_y) or maybe a SHORT formula directly in the serout command, I've also seen some code in my workings with the Innovation First controller that takes several lines to accomplish(i.e. smooth the joystick input, implement a dead zone, etc., etc...) that would be a NIGHTMARE to try and code all into the serout. And even if it can be shortened enough to warrant putting it in the serout, which is easier to quickly understand(i.e. making a quick fix between matches)?

- PWM4 = ((p1_sw_top ^ 1) * 148)+10

OR
- serout USERCPU,OUTBAUD, [255,255,p1_y,relayA,p2_y,p3_y,((p1_sw_top ^ 1) * 148)+10,p4_y,p1_x,p2_x,p3_x,p4_x,p1_wheel,p2_wheel ,p3_wheel,p4_wheel,127,127,127,127]

As a 3rd semester CS major, I have very quickly learned the importance of easy-to-understand code, even if it results in a slightly larger or smaller program.

Just my thoughts...

Nate

__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
 


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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Need to learn PBASIC...Where Should I Go? IMDWalrus Programming 5 29-04-2003 16:43
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
PBasic Question Melissa H. Programming 28 17-11-2002 18:53


All times are GMT -5. The time now is 12:29.

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