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.
Flag.cpp
00001 #include "pins.h" 00002 00003 PwmOut servo(FLAGPIN); 00004 Timeout response; 00005 00006 00007 void FlagGOTO(int pos) 00008 { 00009 servo = (pos*(0.05f)/90)+0.075f; 00010 } 00011 00012 void FlagFROMGOTO(int posinit, int posfin, int pas) 00013 { 00014 int dir = ((posfin - posinit)/abs(posfin - posinit)); 00015 for(int pos = posinit; pos != posfin; pos = pos + (pas*dir)) { 00016 FlagGOTO(pos); 00017 wait_ms(FLAGDELAY2POS); 00018 } 00019 } 00020 00021 void FlagCCW(void) 00022 { 00023 FlagGOTO(90); 00024 //servo = 0.125f; 00025 } 00026 00027 void FlagMid(void) 00028 { 00029 FlagGOTO(0); 00030 //servo = 0.075f; 00031 } 00032 00033 void FlagCW(void) 00034 { 00035 FlagGOTO(-90); 00036 //servo = 0.024f; 00037 } 00038 00039 void FlagUpToInit() 00040 { 00041 FlagFROMGOTO(0, 90, 1); 00042 } 00043 00044 void FlagInitToUp() 00045 { 00046 FlagFROMGOTO(90, 0, 1); 00047 } 00048 00049 void Detonateur(float time) 00050 { 00051 response.attach(&FlagInitToUp, time); 00052 }
Generated on Wed Jul 20 2022 11:03:38 by
1.7.2