To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.ca.rtltorontoOpen lugnet.org.ca.rtltoronto in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / Canada / rtlToronto / 11597
11596  |  11598
Subject: 
Desperate Programming Question
Newsgroups: 
lugnet.org.ca.rtltoronto
Date: 
Sat, 26 Jun 2004 00:19:05 GMT
Viewed: 
473 times
  
I'm so screwed, and I can't figure out why this won't work.  Yes, it's for
tomorrow.  Language is NQC.

I have a light sensor looking at the rope.  I want to "zero" it, after I
latch on and start climbing, and then say, basically "Hey, when the light
value on the sensor goes 5 under what we know the colour of the rope USUALLY
is, you can stop."

So I have something like

#define ropeColour SENSOR_1 // Replace sensor port 1 with ropeColour,
because it's easier to type that way
int whiteRope // placeholder for white rope value.

Then, in the program, once I know I've got the rope in front of the sensor
and it's white:

whiteRope = ropeColour // put the current value of the light sensor, into
the variable whiteRope
whiteRope =- 5 // take 5 off the value of whiteRope

Then, I should have a value in the variable whiteRope which is 5 less than
what I read in?!

But WHY won't this work!? It's driving me nuts!! :(

    Iain



Message has 1 Reply:
  Re: Desperate Programming Question
 
(...) Well I haven't used NQC yet but... (...) ...I believe if it's like C, that should be: whiteRope -= 5 (swap - and =) Your code would result in whiteRope always having the value -5. HTH ROSCO (20 years ago, 26-Jun-04, to lugnet.org.ca.rtltoronto)

3 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