View unanswered posts | View active topics It is currently Mon Dec 22, 2014 6:50 am






Reply to topic  [ 3 posts ] 
New to RobotC, help with color sensing 
Author Message
Rookie

Joined: Sat Nov 17, 2012 8:30 pm
Posts: 2
Post New to RobotC, help with color sensing
Okay so I'm learning how to perform basic functions in RobotC and am getting a warning message with this program that reverses my vehicle once it sees my water bottle. The program runs fine, but I would like to avoid all warning messages if possible.

Code:
#pragma config(Sensor,S3,,sensorCOLORFULL)
#pragma config(Motor,motorB,tmotorNormal,PIDControl)
#pragma config(Motor,motorC,tmotorNormal,PIDControl)

task main()
{
  nSyncedMotors=synchBC;
  while(true)
  {
    motor(motorB)=50;
    if(SensorValue(S3)==BLUECOLOR)
    {
      motor(motorB)=-50;
      wait1Msec(1000);
      break;
    }
  }
}


The message is *Warning*:Invalid '==' operation for types 'short' and 'TColors'. So am I doing something wrong in terms of checking what color is being detected? How can I fix this?


Sat Nov 17, 2012 8:36 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 619
Post Re: New to RobotC, help with color sensing
Which version of ROBOTC are you currently running? I copied and pasted the code and it ran without any warnings; this may be a bug of an older version. Make sure you have the most up-to-date version of ROBOTC (currently 3.54) installed by navigating to the 'Help -> Check for Updates' option in ROBOTC and updating as needed.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Mon Nov 19, 2012 1:25 pm
Profile
Rookie

Joined: Sat Nov 17, 2012 8:30 pm
Posts: 2
Post Re: New to RobotC, help with color sensing
Thanks, that worked!


Tue Nov 20, 2012 12:43 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.