Created an example programme that uses the RenBuggy_Servo library. RenBuggy Figure Of Eight
Dependencies: RenBuggy_Timed
Revision 1:da2f06538364, committed 2014-05-08
- Comitter:
- jf1452
- Date:
- Thu May 08 07:17:56 2014 +0000
- Parent:
- 0:794a1188e0e3
- Commit message:
- RenBuggy Figure Of Eight
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Mar 31 10:19:41 2014 +0000 +++ b/main.cpp Thu May 08 07:17:56 2014 +0000 @@ -1,20 +1,53 @@ /******************************************************************************* -* This programme demonstrates how to use the RenBuggy_Timed library. -* -* Mark Jones -* V1.0 31/03/2014 +* Used to drive RenBuggy with 2 wheels for a specified amount of time. * +* Copyright (c) 2014 Renishaw plc * +* * +* Permission is hereby granted, free of charge, to any person obtaining a copy * +* of this software and associated documentation files (the "Software"), to deal* +* in the Software without restriction, including without limitation the rights * +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * +* copies of the Software, and to permit persons to whom the Software is * +* furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,* +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * +* THE SOFTWARE. * +* * +* RenBuggy_Timed_Program * +* * +* V1.0 8/5/2014 Jon Fuge * *******************************************************************************/ +// We are using the buggy with no wheel encoders so we need to use the timed +// library. #include "RenBuggyTimed.h" -RenBuggy myBuggy(p5, p6, p8, p7); +RenBuggy myBuggy(p5, p6, p8, p7); // Configure control pins for the buggy + +// For this buggy, we only need to use the motor control pins p5 & p6. +// p5 controls the left motor +// p6 controls the right motor int main() { + int iCircleTime; + int iForwardTime; - myBuggy.forward(4); - myBuggy.left(3); - myBuggy.forward(4); - myBuggy.right(3); + iCircleTime = 22; // This is the time in seconds to do one full circle + iForwardTime = 1; // This is the time to move forwards + + myBuggy.stop(); + myBuggy.left(iCircleTime); + myBuggy.forward(iForwardTime); + myBuggy.right(iCircleTime); + myBuggy.forward(iForwardTime); + myBuggy.stop(); return 0; } \ No newline at end of file