{{ YAAARC PropBotSquare.spin

This program and its objects are all under construction.

INSTRUCTIONS
  ‣ Press F8 to compile this application.
  ‣ Double-click the Propeller PingBot Schematic object in the object
    browser window for the various schematics.
  ‣ Compare the schematic to the comments in this object's init code
    block (below).
  ‣ Adjust the schematic, constants section for your particular wiring.
  ‣ Load the code into the Propeller chip with F11, and let it roam.

MORE INFO  
  ‣ Open each of the objects (PiezoSpeaker, PING, etc), and view
    them in documentation mode.  Their instructions should match
    the commands in this object's init section.
    
┌────────────────────────┬────────────────────────┬───────────────┬────────────┐
│ Propeller YAAARC Bot   │ (C)2009 James Ronald   │ Version 0.10  │ Oct. 2009  │
├────────────────────────┴────────────────────────┴───────────────┴────────────┤
│                                                                              │
│ Base on work of Andy Lindsay (C)2008 Parallax, Inc. ( PID Following PEKbot ) │                                                                          │
│                                                                              │
│ The PEKbot package is available for download from the PEKbot thread on the   │
│ Propeller Chip forum:                                                        │
│                                                                              │
│ http://forums.parallax.com/forums/default.aspx?f=25&m=174962                 │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

}}  

CON

  _xinfreq = 5_000_000                      
  _clkmode = xtal1 | pll16x


  ' Wheel Servos 
  L = 0                         ' Pin for Left Wheel Servo
  R = 1                         ' Pin for Right Wheel Servo

  ' Misc 
  PIEZO_Pin = 10                ' Pin for Piezo Speaker
  
VAR
  long index
  
OBJ

  piezo     : "Piezospeaker"
  SERVO     : "Servo32v5"
  Debug     : "FullDuplexSerialPlus"

PUB init

  ' Piezospeaker connected to PIEZO_Pin, beeps at a frequency of 2637 for
  ' 1 second (2637 cycles).
  piezo.beep(PIEZO_Pin, 2637, 2637)
              
  'Send debug messages to Parallax Serial Terminal.
   Debug.start(23, 22, 0, 115200)   'BlueTooth / Dummy                         
   'Debug.start(31, 30, 0, 115200)  'USB Serial 

  ' All are initialized to stop or center.
  SERVO.Set(L, 1500)                              
  SERVO.Set(R, 1500)                              

  ' Start Servo
  SERVO.Start


  
  ' Call the Main method (otherwise, the program would stop here).
  ServoTest                                      

PUB ServoTest                                    

  Debug.str(string("Servo test", 13))

  repeat

    ' calibration  
    SERVO.Set(L,(1500 ))                              
    SERVO.Set(R,(1500 ))                              

    waitcnt(clkfreq/2 + cnt)
   
   