Go to Post it isn't about the technology but about the teams working together. Sneaky GDC has done it again. - dtengineering [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-06-2006, 23:14
foobert foobert is offline
Registered User
no team
 
Join Date: May 2005
Location: oakland, ca
Posts: 87
foobert is a jewel in the roughfoobert is a jewel in the roughfoobert is a jewel in the rough
Re: VEX Start Kit Projects

Quote:
Originally Posted by artdutra04
(Remember, the part of C programming that makes this all possible is that any conditional statement inside parenthesis will return a 1 if true, and a 0 if not. So using the assignment left_drive = 127-42(ultrasonic_value>40); will return either 127 if the ultrasonic sensor value is less than 40, or it will return an 85 if the ultrasonic value is greater than 40. It is these conditionals inside an assigment that makes the three-lines of code possible.)
this is not a good idea. since multiplication is kind of expensive, computationally speaking go with...

Code:
left_drive = (ultrasonic_value > 40) ? 85 : 127;
... which, for anyone unfamiliar with the notation, is pretty much the same as ...

Code:
if (ultrasonic_value > 40) left_drive = 85;
else left_drive = 127;
Reply With Quote
Reply


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
Vex start up code run PWM outputs without Rx intellec7 Programming 3 05-05-2006 23:29
vex programming kit Alex Burman FIRST Tech Challenge 1 30-03-2006 18:30
Start a Vex team NOW! skimoose FIRST Tech Challenge 4 25-01-2006 14:43
VEX kit SALE/DISCOUNT !! Stu Bloom FIRST Tech Challenge 10 13-11-2005 23:24
VEX EDUbot hybrid or $50.00 VEX kit? Tazlikesrobots Robot Showcase 15 13-08-2005 22:12


All times are GMT -5. The time now is 00:59.

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