To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 7880
7879  |  7881
Subject: 
Re: Ic question
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 2 Jun 2000 14:26:53 GMT
Original-From: 
Will Bain <willbain@NOMORESPAMe2egolf.com>
Viewed: 
3735 times
  
As far as I know, the infinite loop construct is the way to do it.  However, you can have multiple processes, each waiting on a sensor, each running in an infinite loop, each using the defer() function to allow switching between processes when appropriate.  Some processes can use the msleep() function to effectively lower their priority.  This seems to be a fairly efficient way to go.

-- Will

Todd Ahlstrom wrote:
> 
> I have been playing around with my handy in command line for a little
> while now.  It seems like the only way I can get it to start doing
> something when a sensor is activated is to have it in an infinite loop
> waiting for that sensor to be pressed.  For example:  I want it to print
> something to the LCD when a button is pressed.  I use a line like this:
> while(!digital(7)); printf...   while this gets the desired result, the
> heartbeat gets very slow while it is executing the infinite loop.  It
> seems like this means that all the processing power is being bogged down
> processing the infinite loop.  What I am hoping to accomplish is to have
> the Handy control a game.  What I want to happen is to have the start
> button pressed, then have the handy read some sensors and react based on
> what it finds.    Is the infinite loop the only way to respond to sensor
> input?  I was hoping to be able to use an if control statement without
> an infinite loop.  i.e.:  if(digital(7)) {do something}; but obviously
> this doesn't work.  If anyone could let me know how they code for sensor
> inputs I would greatly appreciate it.
> 
> Todd


--
+---------------------------------------------------------+
|                       ^^     <^ ^>                      |
|                     /  òó    ó°° \                      |
|                     /  =Y=    U   \                     |
|       Wendy, Will, Tatoosh & Tenzing                    |
+---------------------------------------------------------+

If you steal from one author, it's plagiarism; if you steal
from many, it's research.                  -- Wilson Mizner



Message is in Reply To:
  Ic question
 
I have been playing around with my handy in command line for a little while now. It seems like the only way I can get it to start doing something when a sensor is activated is to have it in an infinite loop waiting for that sensor to be pressed. For (...) (26 years ago, 2-Jun-00, to lugnet.robotics.handyboard)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR