A simple API/Software interface to the LPC17xx PWM peripheral to provide control to up to six RC type servo controllers.

Files at this revision

API Documentation at this revision

Comitter:
AjK
Date:
Thu May 19 22:48:17 2011 +0000
Parent:
2:d6a018232650
Commit message:
1.3 See ChangeLog.h

Changed in this revision

inc/ChangeLog.h Show annotated file Show diff for this revision Revisions of this file
inc/example1.h Show annotated file Show diff for this revision Revisions of this file
inc/example2.h Show annotated file Show diff for this revision Revisions of this file
diff -r d6a018232650 -r 1232505e7206 inc/ChangeLog.h
--- a/inc/ChangeLog.h	Thu May 19 22:46:09 2011 +0000
+++ b/inc/ChangeLog.h	Thu May 19 22:48:17 2011 +0000
@@ -1,17 +1,21 @@
-/*
-
-SimpleRCservos change log history.
-==================================
-
-1.2    19/May/2011
-
-    * Added the SimpleServoControl helper class.
-      See http://mbed.org/forum/helloworld/topic/2303
-      
-1.1     2/May/2011
-    * Fixed some documentation errors.
-    
-1.0     2/May/2011
-    * Initial release.
-
+/*
+
+SimpleRCservos change log history.
+==================================
+
+1.3    19/May/2011
+
+    * Added example2.h
+    
+1.2    19/May/2011
+
+    * Added the SimpleServoControl helper class.
+      See http://mbed.org/forum/helloworld/topic/2303
+      
+1.1     2/May/2011
+    * Fixed some documentation errors.
+    
+1.0     2/May/2011
+    * Initial release.
+
 */
\ No newline at end of file
diff -r d6a018232650 -r 1232505e7206 inc/example1.h
--- a/inc/example1.h	Thu May 19 22:46:09 2011 +0000
+++ b/inc/example1.h	Thu May 19 22:48:17 2011 +0000
@@ -1,4 +1,24 @@
-
+/*
+    Copyright (c) 2011 Andy Kirkham
+ 
+    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.
+*/
 
 #include "mbed.h"
 #include "SimpleRCservos.h"
diff -r d6a018232650 -r 1232505e7206 inc/example2.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/example2.h	Thu May 19 22:48:17 2011 +0000
@@ -0,0 +1,55 @@
+/*
+    Copyright (c) 2011 Andy Kirkham
+ 
+    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.
+*/
+
+// Dervived from http://mbed.org/forum/helloworld/topic/2303
+
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+#include "SimpleRCservos.h"
+#include "SimpleServoControl.h"
+
+SimpleRCservos servos;
+
+SimpleServoControl motor_front_left(&servos, SimpleRCservos::Servo6); // p21
+SimpleServoControl motor_front_right(&servos, SimpleRCservos::Servo5); // p22
+SimpleServoControl motor_rear_left(&servos, SimpleRCservos::Servo4); // p23
+SimpleServoControl motor_rear_right(&servos, SimpleRCservos::Servo3); // p24
+
+int main() 
+{
+    // Led1 on to show program start.
+    led1 = 1;
+    
+    motor_front_left.position(90.0);
+    motor_front_right.position(90.0);
+    motor_rear_left.position(90.0);
+    motor_rear_right.position(90.0);
+    
+    // Led2 on when rotate complete and program ended.
+    led2 = 1;
+    
+    // End, loop forever.
+    while(1);
+}