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: Stepper mbed Servo UniServ
main.cpp
00001 #include "mbed.h" 00002 #include "UniServ.h" 00003 #include "Servo.h" 00004 #include "Stepper.h" 00005 00006 // test code for servo and stepper motors 00007 00008 Servo S0(PB_2); 00009 Servo S1(PC_8); 00010 Servo S2(PC_6); 00011 Servo S3(PB_12); 00012 00013 int main() 00014 { 00015 00016 // initialise and test Servo 00017 S0.Enable(1000,20000); 00018 S1.Enable(1000,20000); 00019 S2.Enable(1000,20000); 00020 S3.Enable(1000,20000); 00021 00022 printf("initialization succesfull\r\n"); 00023 /* 00024 for (int pos = 775; pos < 2150; pos += 25) { 00025 S2.SetPosition(pos); 00026 printf("pos = %d\r\n",pos); 00027 wait(0.1); 00028 }*/ 00029 00030 int i = 500; 00031 00032 while(1) { 00033 /* 00034 S2.SetPosition(1500); 00035 pwm_motor3.write(0.1f); 00036 wait(1); 00037 S2.SetPosition(900); 00038 pwm_motor3.write(0.0f); 00039 wait(1); 00040 */ 00041 printf("position %d\r\n",i); 00042 S2.SetPosition(i); 00043 i=i+50; 00044 00045 wait(1.0f); 00046 00047 } 00048 }
Generated on Thu Jul 21 2022 09:23:25 by
1.7.2