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 / 2084
2083  |  2085
Subject: 
Problem in program
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Thu, 1 May 1997 21:08:00 GMT
Original-From: 
King, Terry <terry.king@fmr.comSTOPSPAM>
Viewed: 
722 times
  
Greetings everyone!
I'm working on a navigation program that has a funny quirk in it. I'm
hoping one of you IC pros can explain my error. As far as reading the
info from the sensors (RS 40 Khz IR module) and activating the motor
ports, it works fine. The strange thing is that the printf statements
"Left object detected" and "Right object detected" don't always print to
the LCD even though the digital port responded properly by activating
the motor port. Several repeated triggerings will eventually result in
the proper statement,but with no definitive pattern. If one of the
statements does appear and then the other dig port is triggered, the
other statement does not always "flip".

The "Object Ahead" statement always responds. By no means are these
statements crucial to my project, but I have the need to understand what
I'm doing wrong. Is there some kind of precedence statement I need to
include or what?

Here is the program:

void main (){
printf ("NAV. TEST\n");
fd(0);                                              /* Left caterpillar
drive */
fd(2);                                              /* Right
caterpillar drive */
while(1) {
while (digital (15))                     /* Left sensor */
  bk(2);
  if (digital (15)) printf ("Left object      detected\n");
  else fd(2);
while (digital (14))                     /* Right sensor */ /* Line 10
*/
  bk(0);
  if (digital (14)) printf ("Right object     detected\n");
  else fd(0);
while (digital (13))                     /* Front sensor */
  if (digital (13)){ printf ("Object ahead\n");
  ao();
  sleep(1.0);
  bk(0);
  bk(2);
  sleep(1.0);                                  /* Experimental-protect
gears*/
  fd(0);
  bk(2);
  sleep(1.0);}
  else{
  fd(0);
  fd(2);}
   }
}

Thanks for any ideas,
Terry King
Terry.King@fmr.com



Message has 2 Replies:
  digital output
 
Has anyone used any external devices with the HandyBoard that require a digital output from the microprocessor, such as pin PA6 or PA7? Currently there is an IR transmitter on PA6, and we want to use such an output to open/close a gripper of a robot (...) (27 years ago, 2-May-97, to lugnet.robotics.handyboard)
  Re: Problem in program
 
(...) Terry, Try putting a sleep(.1); statement after the printf statements the board may be working to fast to read the LCD. Terry Gathright 669@worldnet.att.net (27 years ago, 2-May-97, to lugnet.robotics.handyboard)

4 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