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 / 7878
7877  |  7879
Subject: 
Ic question
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 2 Jun 2000 03:50:01 GMT
Viewed: 
697 times
  
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



Message has 1 Reply:
  Re: Ic question
 
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 (...) (24 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
    

Custom Search

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