Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:0add14ba6212, committed 2019-12-30
- Comitter:
- Joeatsumi
- Date:
- Mon Dec 30 08:55:35 2019 +0000
- Commit message:
- 20191230
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 0add14ba6212 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Dec 30 08:55:35 2019 +0000
@@ -0,0 +1,52 @@
+//==================================================
+//Servo
+//
+//MPU board: mbed LPC1768
+//2019/11/17 A.Toda
+//==================================================
+#include "mbed.h"
+
+//==================================================
+#define SERVO_PERIOD 0.020
+//==================================================
+
+//Port Setting
+
+PwmOut ELE(p21);
+Serial pc(USBTX, USBRX); //UART
+
+//==================================================
+//Timer valiables
+//==================================================
+
+double pulse_width_ele;
+
+//==================================================
+//Main
+//==================================================
+int main() {
+
+ //UART initialization
+ pc.baud(115200);
+
+ //define servo period
+ ELE.period(SERVO_PERIOD); // servo requires 20ms period
+ pulse_width_ele=0.6/1000.0;
+
+ //while
+ while(1) {
+
+ // servo position determined by a pulsewidth between 0.6-2.4ms
+
+ for(int i=0;i<18;i++){
+ pulse_width_ele += ( 0.1/1000.0 );
+ ELE.pulsewidth(pulse_width_ele);
+ pc.printf("Pulse width is %f\r\n",pulse_width_ele);
+ wait(1.0);
+ }
+
+ pulse_width_ele=0.6/1000.0;
+
+ }//while ends
+
+}//main ends
\ No newline at end of file
diff -r 000000000000 -r 0add14ba6212 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 30 08:55:35 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file