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 / 2090
2089  |  2091
Subject: 
Re: Problem in program
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 2 May 1997 10:36:45 GMT
Original-From: 
Terry P. Gathright <669@POSTOFFICE.nomorespamWORLDNET.ATT.NET>
Viewed: 
1823 times
  
King, Terry wrote:
> 
> 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


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



Message is in Reply To:
  Problem in program
 
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 (...) (29 years ago, 1-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
    

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