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 / 1188
1187  |  1189
Subject: 
Re: Help needed for an NQC newbie
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 8 Aug 2001 00:55:49 GMT
Viewed: 
2517 times
  
Try this. I had to change the value of the light sensor and add a While
(true) statement.

task main()
{
SetSensor(SENSOR_3,SENSOR_ROTATION);
ClearSensor(SENSOR_3);
SetSensor(SENSOR_2,SENSOR_LIGHT);
SetPower(OUT_A,2);
while (true)
if (SENSOR_2<40)
{
  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();
}
}


--
Bob Fay
rfay@we.mediaone.net

http://bobfay.50megs.com/index.html
http://www.geocities.com/Heartland/Bluffs/7900/
"Jude Beaudin" <shiningblade@home.com> wrote in message
news:GHptHI.MzE@lugnet.com...
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 1 Reply:
  Re: Help needed for an NQC newbie
 
Thanks a lot. I added the while statement and it worked. As far as the value of the light sensor, I kept the value I had and it worked correctly. I will post pictures of the setup after the weekend and you will understand. Jude Thanks again for the (...) (23 years ago, 8-Aug-01, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Help needed for an NQC newbie
 
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 (...) (23 years ago, 7-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

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