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 / 1184
1183  |  1185
Subject: 
Help needed for an NQC newbie
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Tue, 7 Aug 2001 20:41:42 GMT
Viewed: 
2501 times
  
Hi,

Normally you can see me in .space, .loc.ca, or org.ca and the like. But now
that I have an RCX I want to program a bit.

I have written my first NQC program and compiled it using RCXCC. I then
downloaded it to my RCX but when I press run the legs do not move (i.e. the
program will not run). So I am coming to you instead of banging my head
against the wall.

Here is the code:

task main()
{
SetSensor(SENSOR_3,SENSOR_ROTATION);
ClearSensor(SENSOR_3);
SetSensor(SENSOR_2,SENSOR_LIGHT);
SetPower(OUT_A,2);
if (SENSOR_2<27)
{
  OnFwd(OUT_A+OUT_B);
  until (SENSOR_3>=4);
  Off(OUT_A);
  Wait(100);
  until (SENSOR_2>=32);
  Wait(100);
  until (SENSOR_2>=32);
  OnRev(OUT_A);
  until (SENSOR_3<1);
  Off(OUT_A);
StopAllTasks();
}
}

I think I must have something not declared or something.

Thanks for your help,

Jude



Message has 2 Replies:
  Re: Help needed for an NQC newbie
 
(...) Welcome! (...) ^^ 27 is way too low for a light sensor, so since this test fails your program just ends. Typical is 35 for very dark up to ca 50 for reflection on a bright surface, and higher if it looks into bright light. Use the View key to (...) (23 years ago, 7-Aug-01, to lugnet.robotics.rcx.nqc)
  Re: Help needed for an NQC newbie
 
Try this. I had to change the value of the light sensor and add a While (true) statement. task main() { SetSensor(SENSOR_3,S...ROTATION); ClearSensor(SENSOR_3); SetSensor(SENSOR_2,S...OR_LIGHT); SetPower(OUT_A,2); while (true) if (SENSOR_2<40) { (...) (23 years ago, 8-Aug-01, to lugnet.robotics.rcx.nqc)

4 Messages in This Thread:


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

Custom Search

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