View unanswered posts | View active topics It is currently Wed Aug 27, 2014 11:35 am






Reply to topic  [ 2 posts ] 
Return Codes 
Author Message
Rookie

Joined: Tue Oct 04, 2011 6:22 am
Posts: 7
Post Return Codes
Hi all,

after my first steps with programming our NXT 2.0 Robot I still have beginner questions. I checked too in the help of the RobotC IDE but I cannot find it.

Is there a possibility to give return/exit codes and can I check on it with the robot?

My next question is if it is possible to include an error handling and are error codes available, so I can display them?

Thanks and regards

Stefan


Sun Aug 12, 2012 9:08 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3196
Location: Rotterdam, The Netherlands
Post Re: Return Codes
Just like with C, you can declare a function to have a specific return type.
Code:
bool isItTrue(int checkthis)
{
  if (checkthis == 2)
    return true;  // return true
  else
   return false;
}

You can specify many return types, including int, long, bool and float.
Code:
int  addUp(int num1, int num2)
{
  return num1 + num2;
}

For debugging purposes, have a look at the Sample Programs\NXT\NXT Feature Samples\Debug Stream.c program. I use this extensively.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Aug 12, 2012 9:36 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.