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






Reply to topic  [ 3 posts ] 
Mismatched typedefs error. 
Author Message
Rookie

Joined: Thu May 21, 2015 10:02 am
Posts: 2
Post Mismatched typedefs error.
Hi,

I was wondering why I was getting a typedef error for my code.
Code:
task main()
{
startMotor(flashlight, 127);
int count = 0;
while(count < 23)
{
startMotor(motor1, 15);
wait(.3);
stopMotor(motor1);
wait(3);
count = count + 1;
}
clearTimer(T1);
while(timer1 <120000)
{
if(lightSensor <= 700)
{
   startMotor(servoMotor, 127);
   wait(2);
   startMotor(motor2, 20);
   wait(.35);
   stopMotor(motor2);
   wait(4);
}
else(lightSensor >=875);
{
   startMotor(servoMotor, -127);
   wait(1);
   startMotor(motor2, 20);
   wait(.35);
   stopMotor(motor2);
   wait(4);
}
}
}


The typedef errors I'm getting read
Code:
*Warning*:Mismatched typedefs. Converting typedef 'long' to typedef 'TTimers', value '0x1D4C0'
*Warning*:Mismatched typedefs. Converting typedef 'short' to typedef 'tSensors', value '0x036B'
*Warning*:Mismatched typedefs. Converting typedef 'short' to typedef 'tSensors', value '0x02BC'


I'm trying to code a marble sorting robot for my Project Lead the Way class, and I can't seem to get it to work. Theoretically, the code should be correct. Is there something I'm doing wrong?


Thu May 21, 2015 10:06 am
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: Mismatched typedefs error.
Your code is very close, but it is coded incorrectly on two major aspects; accessing the timers, and accessing the sensors. For example:

Code:
   while(timer1 <120000)


To access a timer's value, you should instead use the "time1[nameOfTimer]" command, like this:

Code:
   while(time1[T1]<120000)


Likewise, you need to make sure you are using the 'SensorValue' command to access the values of your sensors. This line of code:

Code:
if(lightSensor <= 700)


should instead be:

Code:
if(SensorValue(lightSensor) <= 700)


Once you make those changes (as well as the changes to any other places that you access sensors/timers) your code should be good to go from a syntax standpoint.

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


Thu May 21, 2015 10:52 am
Profile
Rookie

Joined: Thu May 21, 2015 10:02 am
Posts: 2
Post Re: Mismatched typedefs error.
Thank you so much! It worked like a charm! ^_^


Fri May 22, 2015 9:42 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.