View unanswered posts | View active topics It is currently Mon Oct 22, 2018 11:08 am






Reply to topic  [ 4 posts ] 
Can someone explain this compiler error to me? 
Author Message
Rookie

Joined: Sat Apr 25, 2015 3:21 pm
Posts: 2
Post Can someone explain this compiler error to me?
I recently got a VEX IQ kit for my birthday and I downloaded ROBOTC. I know some things from my STEM class, but I am new to the VEX IQ version of it. I selected natural language, and I tried to use commands "waitUntil(getColorName(colorOrange));" and "waitUntil(getColorName(colorNone));". And there was a compiler error saying "**Error**:Expression does not fit parameter. Call to 'getColorName'. Parameter: 'tSensors nDeviceIndex' is 'colorOrange' of type 'TSimpleColors'.
**Error**:Expression does not fit parameter. Call to 'getColorName'. Parameter: 'tSensors nDeviceIndex' is 'colorNone' of type 'TSimpleColors'.
" So I need help. I was very excited about making this until I came across this error. Please help!


Sat Apr 25, 2015 3:28 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Can someone explain this compiler error to me?
Could you please paste the whole program?

Thanks!

= 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 Apr 26, 2015 1:48 am
Profile WWW
Rookie

Joined: Sat Apr 25, 2015 3:21 pm
Posts: 2
Post Re: Can someone explain this compiler error to me?
mightor wrote:
Could you please paste the whole program?

Thanks!

= Xander

Okay. Here is the whole code.
#pragma config(Sensor, port7, colorSensor, sensorVexIQ_Color12Color)
#pragma config(Motor, motor1, leftMotor, tmotorVexIQ, PIDControl, reversed, driveLeft, encoder)
#pragma config(Motor, motor6, rightMotor, tmotorVexIQ, PIDControl, reversed, driveRight, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
while (true)
{
setMotor(motor1, -100);
waitUntil(getColorName(colorOrange));
stopAllMotors();
setMotor(motor6, 100);
waitUntil(getColorName(colorNone));
stopAllMotors();
}
}
Also I was trying to make a line follower.


Sun Apr 26, 2015 1:00 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Can someone explain this compiler error to me?
Hi there,

I made some changes to your program and added some comments. I hope this helps make things a little clearer.

= Xander
Code:
#pragma config(Sensor, port7, colorSensor, sensorVexIQ_Color12Color)
#pragma config(Motor, motor1, leftMotor, tmotorVexIQ, PIDControl, reversed, driveLeft, encoder)
#pragma config(Motor, motor6, rightMotor, tmotorVexIQ, PIDControl, reversed, driveRight, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
  while (true)
  {
    // I have changed it from motor1 to leftMotor, so it's more
    // obvious which motor is being powered.  Same goes for motor6
    // further below.
    setMotor(leftMotor, -100);
    // getColorName expects a sensor, not a color
    // It will return the colour that is currently detected
    waitUntil(getColorName(colorSensor) == colorOrange);
    stopAllMotors();
    setMotor(rightMotor, 100);
    waitUntil(getColorName(colorSensor) == colorNone);
    stopAllMotors();
  }
}

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


Mon Apr 27, 2015 1:07 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.