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.
main.cpp
00001 #include "mbed.h" 00002 //Program to 'sweep' test a 'standard RC type servo 00003 //Define some parameters using compiler directive '#define' 00004 //Check Servo DATA if 0.75ms to 2.25ms then use min=750 and max=2250 00005 //NB be values in microseconds (Following are generic values) 00006 #define MID 1500 00007 #define MIN 1000 00008 #define MAX 2000 00009 #define STEP 50 00010 #define TIME 100 00011 PwmOut myServo(D5); 00012 InterruptIn Incrementa(USER_BUTTON); 00013 InterruptIn Decrementa(D15); 00014 void dispara1() { 00015 for (int i=MIN;i<=MAX;i+=STEP){ 00016 myServo.pulsewidth_us(i); 00017 wait_ms(TIME); 00018 } 00019 } 00020 void dispara2() { 00021 for (int i=MAX;i>=MIN;i-=STEP){ 00022 myServo.pulsewidth_us(i); 00023 wait_ms(TIME); 00024 } 00025 } 00026 00027 int main() { 00028 myServo.period_ms(20); 00029 while(true) { 00030 Decrementa.fall(&dispara1); 00031 Incrementa.fall(&dispara2); 00032 } 00033 }
Generated on Mon Jul 18 2022 17:38:07 by
1.7.2