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.
Dependencies: mbed
Revision 0:aff2ce7d4765, committed 2015-10-22
- Comitter:
- fkgjh
- Date:
- Thu Oct 22 12:01:15 2015 +0000
- Commit message:
- Servomotor - sakte opp, fort ned;
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Oct 22 12:01:15 2015 +0000
@@ -0,0 +1,68 @@
+#include "mbed.h"
+#include "PwmOut.h"
+
+PwmOut servoMotor(PA_7);
+
+int main()
+{
+ servoMotor.period(.01);
+ while(true)
+ {
+ int i;
+
+ for(i=1000;i<=2000;i++)
+ {
+ servoMotor=1;
+ servoMotor.pulsewidth_us(1000);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1050);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1100);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1150);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1200);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1250);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1300);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1350);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1400);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1450);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1500);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1550);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1600);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1650);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1700);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1750);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1800);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1850);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1900);
+ wait(0.2);
+ servoMotor.pulsewidth_us(1950);
+ wait(0.2);
+ servoMotor.pulsewidth_us(2000);
+ }
+
+ wait(0.2);
+ for(i=2000;i>=1000;i--)
+ {
+ servoMotor=2;
+ servoMotor.pulsewidth_us(2000);
+
+ }
+ wait(0.2);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 22 12:01:15 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file