To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1825
1824  |  1826
Subject: 
Re: compiling problem
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 21 Oct 2005 12:37:03 GMT
Viewed: 
5771 times
  
You are missing semicolons after the:
     Wait(turn_time)

lines (both)


And a code suggestion, instead of:

task drive()
{
while(true)
{
   OnFwd(OUT_A);
}
}


make it:
task drive()
{
  OnFwd(OUT_A);
while(true)
{
}
}

as the motor stays OnFwd until turned off.  No need to  keep calling the OnFwd.


-Rob A>



On 10/21/05, bennett lovelady wrote:
could someone please tell me what is wrong with this program?
i am new at nqc and can not seem to find a way to compile it.
the program is for a front-wheel-drive tricycle similar to Michael Gasperi's
version of a "grey walter turtle"

#define turn_time 270

task main()
{
  SetSensor(SENSOR_1,SENSOR_LIGHT);
  SetSensor(SENSOR_2,SENSOR_TOUCH);
  SetSensor(SENSOR_3,SENSOR_TOUCH);
  start drive;
  start steer;
}

task drive()
{
  while(true)
  {
    OnFwd(OUT_A);
  }
}

task steer()
{
  while(true)
  {
    Off(OUT_C);
    Wait(Random(400));
    if(Random(1) == 0)
    {
      OnFwd(OUT_C);
      Wait(turn_time);
      Off(OUT_C);
      Wait(Random(200));
      OnRev(OUT_C);
      Wait(turn_time)
    }
    else
    {
      OnRev(OUT_C);
      Wait(turn_time);
      Off(OUT_C);
      Wait(Random(200));
      OnFwd(OUT_C);
      Wait(turn_time)
    }
  }
}

thanks




Message has 1 Reply:
  Re: compiling problem
 
thanks for the advice rob, it compiled successfully (19 years ago, 21-Oct-05, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  compiling problem
 
could someone please tell me what is wrong with this program? i am new at nqc and can not seem to find a way to compile it. the program is for a front-wheel-drive tricycle similar to Michael Gasperi's version of a "grey walter turtle" #define (...) (19 years ago, 21-Oct-05, to lugnet.robotics.rcx.nqc)

6 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR