Subject:
|
How is this?
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Sat, 23 Jan 2010 19:38:01 GMT
|
Viewed:
|
21034 times
|
| |
| |
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 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.
We're using NXT-G 2.0
|
|
Message has 1 Reply: | | Re: How is this?
|
| (...) 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 (...) (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
|
|
|
|