View unanswered posts | View active topics It is currently Fri Jul 01, 2016 2:24 am

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Control Functions
Author Message
Rookie

Joined: Fri Feb 03, 2012 4:30 pm
Posts: 2
Control Functions
Is is possible to write a code similar to the following?
I have a student who wants to use the linefollower with a range of values.

IF (sensorvalue) 350< x < 700

Thu Mar 08, 2012 1:52 pm
Novice

Joined: Sat Jul 10, 2010 3:06 pm
Posts: 86
Location: Roanoke, VA
Re: Control Functions
 jgillespie wrote:Is is possible to write a code similar to the following? I have a student who wants to use the linefollower with a range of values.IF (sensorvalue) 350< x < 700

Yes and no. You cannot have a "compound" inequality as condition for an if statement.

HOWEVER...

350 < x < 700 is the same thing as saying

350 < x
AND
x < 700

which is the same as
x > 350
AND
x < 700

Converted to code:
 Code:if ((SensorValue[sensor] > 350) && (SensorValue[sensor] < 700))

&& is the logical AND

//Andrew

_________________
Check out my website! www.RoboDesigners.com

VRC Team 2190

Thu Mar 08, 2012 2:21 pm

Joined: Tue May 15, 2007 9:02 am
Posts: 409
Re: Control Functions
We also have a video produced which might help illustrate how this works: http://www.education.rec.ri.cmu.edu/products/teaching_robotc_cortex/reference/video/booleanlogic_p2.html

_________________
Jesse Flot
ROBOTC Support

Mon Mar 12, 2012 2:49 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 3 posts ]

#### Who is online

Users browsing this forum: nekinzjuriya and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning