NXT-G:Controlling motor duration with light sensor variables

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
simonauv
Posts: 13
Joined: 29 Aug 2012, 18:43
Location: Australia

NXT-G:Controlling motor duration with light sensor variables

Post by simonauv »

I'm trying to do a basic linefollow program which I can do without using variables easily enough but I thought I'd try and be a little more creative and put a calibration routine in, based loosely on the nxtprograms.com smoothfollow program calibration routine. As such I have four variables; White, Black, Grey, and Light. Light is a dynamic variable that is frequently rewritten from the light intensity value from a single light sensor. White and Black are measured by scanning to the left (and back again) whilst values are continually fed back so that the max. is set as White and the min. is set as Black. Grey is just (Black + White)/2. This, and the turn on green routine I've made, work but the line follow part based on the light sensors data and the variables don't work.

What I want to do is use these variables to control the duration of a motor block. I want it to move either left or right until it is either greater or less that Grey but nothing I've tried works. So far I've been doing things like this:

Image

and

Image

This does not work and I can't see why... how can I make this work?

TIA,

Simon
simonauv
Posts: 13
Joined: 29 Aug 2012, 18:43
Location: Australia

Re: NXT-G:Controlling motor duration with light sensor variables

Post by simonauv »

closed... we made it work on our own.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests