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: LocalPositionSystem MMA8451Q Motor_Driver Sensors mbed
Fork of TDP_main by
shooter.h
00001 /* 00002 Header file for Shooting mechanism. 00003 00004 Takes dutyCycle as a float and converts it t oduty cycle. 00005 When off- dutyCycle is just switched to 0 duty cycle. 00006 00007 IMPORTANT: need to convert back to dutycycle=0, when not used!! 00008 00009 Possible improvements: 00010 -Convert program so when it's off the pins are completely off??? 00011 -Caclutalate better time for the waits??? 00012 -maybe change the period?? 00013 00014 TESTED AND WORKING - 06/03 00015 IK 00016 */ 00017 00018 #ifndef _SHOOTER_H 00019 #define _SHOOTER_H 00020 00021 PwmOut squareOut(PTE31); //TESTED WORKING 00022 DigitalOut solenoid(PTA17); 00023 00024 void shoot(float dutyCycle) { 00025 00026 squareOut.period(0.01f); // 0.01 second period 00027 squareOut.write(dutyCycle); // 50% duty cycle 00028 wait(1.7); // give time for motors to reach optimal speed - is it needed 00029 00030 if (dutyCycle == 0.0) //if not used any more, don't shoot 00031 return; 00032 00033 solenoid = 1; //push solenoid 00034 wait (0.3); // wait needed 00035 solenoid = 0; //pull it back 00036 00037 return; 00038 } 00039 00040 #endif
Generated on Sun Jul 17 2022 02:58:24 by
1.7.2
