To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 1160
1159  |  1161
Subject: 
Re: How is this?
Newsgroups: 
lugnet.robotics.nxt
Date: 
Sat, 23 Jan 2010 23:37:14 GMT
Viewed: 
20393 times
  
In lugnet.robotics.nxt, Edwin Pilobello wrote:
The program in NXT-G is simple:

Loop forever
  If Touched
  {
     wait for ultrasonic < 9"
     turn MotorA forward unlimited
  }
  else
  {
      turn MotorA off
  }

If touched and distance > 9, MotorA does not move.
If touched and distance < 9 MotorA turns
-- If untouched and distance is < 9, MotorA stops
-- If untouched and distance is > 9. MotorA keeps on turning!

The last condition is what's bugging us.  Why does the motor not stop if
distance is greater than 9"?  I have always assumed the switch block would take
the bottom (negative) logic when untouched.  As it is now, the motor keeps
spinning until the ultrasonic detects < 9".  Obviously, after the motor starts
turning, it ignores the touch sensor.

I can see how this can happen and it depends on the sequence of events.  This
sequence will cause this behavior:
  touched   AND  distance < 9    - Motor turns on
  touched   AND  distance > 9    - Motor running, waiting for distance < 9
  untouched AND  distance > 9    - Motor running, still waiting for distance < 9

This may be a good time to introduce data wires and using the logic block to do
a logical AND.

Gus



Message has 1 Reply:
  Re: How is this?
 
(...) Yes, change the "wait for 9" to be a "check for 9", and the problem should go away... Loop forever if Touched and distance < 9 { turn on motor } else { turn off motor } Kevin (14 years ago, 19-Aug-10, to lugnet.robotics.nxt)

Message is in Reply To:
  How is this?
 
One of my students built the chainsaw model from nxtprograms.com. He wanted to make the blade turn only when it was at a distance less than 9 inches from the table. So he attached an ultrasonic and made one mod to the program. The program in NXT-G (...) (15 years ago, 23-Jan-10, to lugnet.robotics.nxt)

3 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