This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Thursday, August 14, 2008

[oopic] Digest Number 3910

There are 6 messages in this issue.

Topics in this digest:

1a. Re: Need help--oIRRange Object
From: Bob Hedges
1b. Re: Need help--oIRRange Object
From: shubo zhang

2a. Serial Control Protocol
From: shubo zhang
2b. Re: Serial Control Protocol
From: Ian Drennan
2c. Re: Serial Control Protocol
From: Dave Warner
2d. Re: Serial Control Protocol
From: Andrew Porrett


Messages
________________________________________________________________________
1a. Re: Need help--oIRRange Object
Posted by: "Bob Hedges" bhmtr@mindspring.com bobhedges9
Date: Wed Aug 13, 2008 5:20 am ((PDT))

The subroutine Setup is never called.

--- In oopic@yahoogroups.com, shubo zhang <shubozhang@...> wrote:
>
> Hey, I try to use oIRRange Object(sharp GP2D12) to achieve obstacle
avoidence.But it fails to read value from the sensor. I follow the
oIRRange Object instruction and connect sensor to board. The code is
blow. Please help me out. Thank you very much !
>  
>
> oServo S1 = New oServo;   // Make a servo object.
> oServo S2 = New oServo;   // Make a servo object.
>
> oByte x = New oByte;      // Make an 8-bit variable.
>
> oIRRange I=New oIRRange;
> oDIO8 P=New oDIO8;
>
> Sub Void main(Void)
> {
>      S1 = 28;
>      S2=28;
>      x=1;
>     
>      I.IOLine=3;
>      I.Operate=1;
>      I.Adjust=8;
>      P.IOGroup=1;
>      P.Direction=cvOutput;
>   Do
>   {
>      
>      S1 = 20;
>      S2 = 20;
>      
>      ooPIC.Delay = 50;
>      S1= 40;
>      S2=40;
>       x++
>      
>      P.Value=I.Value;
>     
>      If(P>=64)                \\ I think there is something wrong at
this place.
>      {x=11;}
>   } While (x<=10); 
>         x=1;
>  
>   Do
>   {
>      ooPIC.Delay = 50;
>      S1 = 40;
>      S2=40;
>     ooPIC.Delay = 50;
>      S1 = 28;
>      S2=28;
>       x++    
>   } While (x<=5);
> }
>
> Sub Void Setup(Void)
> {
>   //--Set up the first servo--
>   S1.IOLine = 31;      //Set the servo to use I/O Line 31.
>   S1.Center = 28;      //Set the servos center to 28. (see manual)
>   S1.Operate = cvTrue;
>   //--Set up the second servo--
>  
>   S2.IOLine = 30;      //Set the servo to use I/O Line 30.
>   S2.Center = 28;      //Set the servos center to 28. (see manual)
>   S2.Operate = cvTrue;   //Last thing to do, Turn the Servo on.
>  }
>
>
>
>
> [Non-text portions of this message have been removed]
>


Messages in this topic (3)
________________________________________________________________________
1b. Re: Need help--oIRRange Object
Posted by: "shubo zhang" shubozhang@yahoo.com shubozhang
Date: Wed Aug 13, 2008 7:21 am ((PDT))

Hey,
 
First, thank you for answering my question. Because the code is too long, so I did not copy completely. The code does work now. But I still have trouble in setting P.Value. Is P a binary result?  I just want to use IF selection to select P.Value. When the distance is less than 40cm, it will execute another part. Please help me to address this problem. Thank you very much !

#Code:
 
//--The robot will move forward. When it detects an obstacle, robot will move backward.--
//-----------------------------------------------------------------
oServo S1 = New oServo;   // Make a servo object.
oServo S2 = New oServo;   // Make a servo object.
oServo S3 = New oServo;
oServo S4 = New oServo;
oServo S5 = New oServo;
oServo S6 = New oServo;
oServo S7 = New oServo;
oServo S8 = New oServo;
oByte x = New oByte;      // Make an 8-bit variable.

oIRRange I=New oIRRange;
oDIO8 P=New oDIO8;
 
Sub Void main(Void)
{
  //--Go set up the servo object properties--
  Setup;
 
     S1 = 28;
     S3 = 28;
     S5 = 28;
     S7 = 28;
     S2 = 28;
     S4 = 28;
     S6 = 28;
     S8 = 28;
     x=1;
    
     I.IOLine=3;
     I.Operate=1;
     I.Adjust=8;
     P.IOGroup=1;
     P.Direction=cvOutput;
    
   //--forward-- 
 
  Do
  {
     //--Set the servos to 0% and then wait a while--
     S1 = 28;
     S5 = 20;
     S3 = 36;
     S7 = 28;
   
 
     ooPIC.Delay = 50;
     S3 = 40;
 
     ooPIC.Delay = 50; 
     S5 = 28;
     ooPIC.Delay = 50;
     S1 = 16;
     S7 = 16;
   
     ooPIC.Delay = 50; 
  
     S3 = 28;
    
     ooPIC.Delay = 50; 
     S5 = 40;
     ooPIC.Delay = 50; 
     S1 = 28;
     S7 = 28;
   
   
   
    ooPIC.Delay = 50;
     S3 = 16;
 
     ooPIC.Delay = 50; 
     S5 = 28;
     ooPIC.Delay = 50;
     S1 = 40;
     S7 = 40;
   
     ooPIC.Delay = 50; 
  
     S3 = 28;
    
     ooPIC.Delay = 50; 
     S5 = 16;
     ooPIC.Delay = 50; 
     S1 = 28;
     S3 = 20;
     S5 = 36;
     S7 = 28;
      x++
     
     P.Value=I.Value;     //--read sensor's value
    
     If(P>=120)
     {x=101;}
  } While (x<=100);
 
 
  ooPIC.Delay = 500;
     S1 = 28;
     S3 = 28;
     S5 = 28;
     S7 = 28;
     S2 = 28;
     S4 = 28;
     S6 = 28;
     S8 = 28;
      x=1;
     
     
//--Backward--
 
  Do
  {
    
     S1 = 28;
     S5 = 20;
     S3 = 36;
     S7 = 28;
   
 
     ooPIC.Delay = 50;
     S5 = 16;
 
     ooPIC.Delay = 50; 
     S3 = 28;
     ooPIC.Delay = 50;
     S1 = 40;
     S7 = 40;
   
     ooPIC.Delay = 50; 
  
     S5 = 28;
    
     ooPIC.Delay = 50; 
     S3 = 16;
     ooPIC.Delay = 50; 
     S1 = 28;
     S7 = 28;
   
   
   
    ooPIC.Delay = 50;
     S5 = 40;
 
     ooPIC.Delay = 50; 
     S3 = 28;
     ooPIC.Delay = 50;
     S1 = 16;
     S7 = 16;
   
     ooPIC.Delay = 50; 
  
     S5 = 28;
    
     ooPIC.Delay = 50; 
     S3 = 40;
     ooPIC.Delay = 50; 
     S1 = 28;
     S5 = 20;
     S3 = 36;
     S7 = 28;
  
     x++
   
    
  } While (x<=5);
 
  ooPIC.Delay = 500;
     S1 = 28;
     S3 = 28;
     S5 = 28;
     S7 = 28;
     S2 = 28;
     S4 = 28;
     S6 = 28;
     S8 = 28;
}
//-----------------------------------------------------------------
//  A routine that sets up our servo properties
//-----------------------------------------------------------------
Sub Void Setup(Void)
{
  //--Set up the first servo--
  S1.IOLine = 31;      //Set the servo to use I/O Line 31.
  S1.Center = 28;      //Set the servos center to 28.
  S1.Operate = cvTrue;
  //--Set up the second servo--
 
  S2.IOLine = 30;      //Set the servo to use I/O Line 30.
  S2.Center = 28;      //Set the servos center to 28. 
  S2.Operate = cvTrue;   //Last thing to do, Turn the Servo on.

  S3.IOLine = 29;      //Set the servo to use I/O Line 29.
  S3.Center = 28;      //Set the servos center to 28.
 
  S3.Operate = cvTrue; //Last thing to do, Turn the Servo on.

  S4.IOLine = 28;      //Set the servo to use I/O Line 28.
  S4.Center = 28;      //Set the servos center to 28.
  S4.Operate = cvTrue; //Last thing to do, Turn the Servo on.
  S5.IOLine = 15;      //Set the servo to use I/O Line 15.
  S5.Center = 28;      //Set the servos center to 28.
  
  S5.Operate = cvTrue; //Last thing to do, Turn the Servo on.
 
  S6.IOLine = 14;      //Set the servo to use I/O Line 14.
  S6.Center = 28;      //Set the servos center to 28.
  S6.Operate = cvTrue; //Last thing to do, Turn the Servo on.
 
  S7.IOLine = 13;      //Set the servo to use I/O Line 13.
  S7.Center = 28;      //Set the servos center to 28.
 
  S7.Operate = cvTrue; //Last thing to do, Turn the Servo on.
 
  S8.IOLine = 12;      //Set the servo to use I/O Line 12.
  S8.Center = 28;      //Set the servos center to 28. 
  S8.Operate = cvTrue; //Last thing to do, Turn the Servo on.
  }


[Non-text portions of this message have been removed]

Messages in this topic (3)
________________________________________________________________________
________________________________________________________________________
2a. Serial Control Protocol
Posted by: "shubo zhang" shubozhang@yahoo.com shubozhang
Date: Wed Aug 13, 2008 12:56 pm ((PDT))

Hey,
 
My board is ooPIC-R (c.1.1.+). Can I control the board over the serial port ?
 
Thanks !
 


[Non-text portions of this message have been removed]

Messages in this topic (4)
________________________________________________________________________
2b. Re: Serial Control Protocol
Posted by: "Ian Drennan" ianid@sai.co.za iand242002
Date: Wed Aug 13, 2008 1:25 pm ((PDT))

shubo zhang wrote:
> Hey,
>
> My board is ooPIC-R (c.1.1.+). Can I control the board over the serial port ?
>
> Thanks !
>
>
>
>
>
>
Yes you can. SCP is also used to program your oopic using the Serial port.

Ian


Messages in this topic (4)
________________________________________________________________________
2c. Re: Serial Control Protocol
Posted by: "Dave Warner" BIMI_TYEDYE@HOTMAIL.COM bimi_tie_dye
Date: Wed Aug 13, 2008 2:31 pm ((PDT))


To what depth can we control the OOPIC? Please elaborate.
http://revealyourinnerathlete.windowslive.com?locale=en-us&ocid=TXT_TAGLM_WLYIA_whichathlete_us

[Non-text portions of this message have been removed]

Messages in this topic (4)
________________________________________________________________________
2d. Re: Serial Control Protocol
Posted by: "Andrew Porrett" slicerwizard@gmail.com slicerwizard
Date: Wed Aug 13, 2008 11:34 pm ((PDT))

At 05:31 PM 8/13/2008, Dave Warner wrote:

>To what depth can we control the OOPIC? Please elaborate.

You can stop/start/reset your script code or completely reprogram
it. You can query or change the values of variables or objects. You
can load/retrieve data tables to/from the EEPROM. Or you can do the
usual stuff, which is to just have your OOPic code accept simple
commands from your PC. What you do depends on what you want/need to do.


...Andy


Messages in this topic (4)

------------------------------------------------------------------------
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Digest Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-normal@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

------------------------------------------------------------------------

No comments: