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: PID QEI ikarashiMDC recieveController omni
Spiral.cpp
00001 #include "Spiral.h" 00002 00003 Spiral::Spiral(ikarashiMDC *spiralMotor_) 00004 { 00005 beltSpeed = 0; 00006 spiralSpeed = 0; 00007 spiralMotor = spiralMotor_; 00008 spiralLimit = new InterruptIn(PB_12); 00009 spiralLimit->mode(PullUp); 00010 spiralLimit->rise(this,&Spiral::stopRotation); 00011 rotating = false; 00012 firing = false; 00013 spiralLimit->enable_irq(); 00014 } 00015 00016 int Spiral::rotate() 00017 { 00018 if(rotating) 00019 return 1; 00020 spiralSpeed=-.5; 00021 spiralMotor->setSpeed(-.5); 00022 rotating = true; 00023 firing = true; 00024 return false; 00025 } 00026 00027 void Spiral::stopRotation() 00028 { 00029 if (!rotating)return; 00030 spiralSpeed=0; 00031 spiralMotor->setSpeed(0); 00032 rotating = false; 00033 beltTime.attach(callback(this,&Spiral::beltStart),0.1); 00034 } 00035 00036 void Spiral::beltStart() 00037 { 00038 beltSpeed=-1; 00039 beltTime.attach(callback(this,&Spiral::beltStop),0.1); 00040 } 00041 void Spiral::beltStop(){ 00042 beltSpeed=0; 00043 firing = false; 00044 }
Generated on Sun Jul 31 2022 12:04:46 by
