View unanswered posts | View active topics It is currently Thu Jul 24, 2014 1:01 pm






Reply to topic  [ 2 posts ] 
setFriendlyName("Name"); not working in RobotC 3.60 
Author Message
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post setFriendlyName("Name"); not working in RobotC 3.60
So yeah, post title says it all. This code doesn't compile:
Code:
void btLSetUp(bool masterOrSlave){ //true = master; false = slave
   setBluetoothOn();
   setBluetoothVisibility(true);
   if(masterOrSlave == true)
      setFriendlyName("Albert");
   else
      setFriendlyName("Jeeves");
}
I get this error for both times setFriendlyName is called:
Code:
**Error**:'const' expressions does not fit. Call to 'setFriendlyName'. Parameter: 'unsigned string & sFriendlyName' is '"Jeeves"' of type 'string'.
From the documentation, I don't see how I'm calling it wrong. Bug?

Thanks,
- Leon

_________________
leonoverweel.com


Thu May 02, 2013 5:45 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: setFriendlyName("Name"); not working in RobotC 3.60
It has to do with pointers, I suspect. In any case, this bit of code works quite nicely:
Code:
void btLSetUp(bool isMaster){ //true = master; false = slave
  string name;
  setBluetoothOn();
  setBluetoothVisibility(true);
  name = (isMaster) ? "Albert" : "Jeeves";
  setFriendlyName(name);
}

task main()
{
  btLSetUp(true);
}


I've tested this with ROBOTC 3.60.

= 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]


Fri May 03, 2013 1:33 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:  
cron



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