View unanswered posts | View active topics It is currently Mon Sep 21, 2020 3:56 pm

Reply to topic  [ 3 posts ] 
My Code won't Compile... 
Author Message

Joined: Thu Jan 15, 2015 5:19 pm
Posts: 1
Post My Code won't Compile...
Hey everyone. I'm new to RobotC and I got a tutorial from FTC Mentor Training. I followed it exactly but everytime I press download and compile it wont work. Here is the code:

task main()
int dValue = 15; // motor power
int threshold = 50; // light sensor threshold
int mValue = 30;

while(SensorValue(LightSensor) > threshold)
motor[motorD]= dValue;
motor[motorE]= dValue;


while {SensorValue(LightSensor) < threshold)
motor[motorD] = mValue;
motor[motorE] = mValue* (-1);

motor[motorD] = 0;
motor[motorE] = 0;

Any help would be appreciated.

Thu Jan 15, 2015 5:30 pm
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: My Code won't Compile...
Without seeing the rest of the code, it will be hard to tell if it's a configuration issue, but...

while {SensorValue(LightSensor) < threshold)

Note the first curly brace { after the while loop. This should be a parenthesis instead:

while (SensorValue(LightSensor) < threshold)

Try that and let us know if it fixes the issue you're running into.

Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

Thu Jan 15, 2015 6:13 pm

Joined: Sun Feb 15, 2015 5:50 pm
Posts: 2
Post Re: My Code won't Compile...
You cannot put SensorValue(LightSensor) because this should be a port number and you should initiate what sensors you are using in the beginning by using SensorType[S1] = sensorLightActive;
or just replace the S1 part with whatever port you are using.

Sun Feb 15, 2015 6:21 pm
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:  

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