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:4887ccec9d82, committed 2021-10-13
- Comitter:
- cspista
- Date:
- Wed Oct 13 14:00:26 2021 +0000
- Commit message:
- Final version
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 Wed Oct 13 14:00:26 2021 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+PwmOut servo(D3);
+
+int main() {
+ servo.period_ms(20); //Period = 20 ms (f=50 Hz)
+ while(true) {
+ for(int pw=1000; pw <= 2000; pw=pw+20) {
+ servo.pulsewidth_us(pw); //Set new servo position
+ wait_ms(200);
+ }
+ wait_ms(1000); //Wait before reverse direction
+ for(int pw=2000; pw >= 1000; pw=pw-20) {
+ servo.pulsewidth_us(pw); //Set new servo position
+ wait_ms(200);
+ }
+ wait_ms(1000);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 13 14:00:26 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file