2017ロボコンはやとブーメランプログラム

Dependencies:   PID QEI ikarashiMDC recieveController omni

Spiral.cpp

Committer:
WAT34
Date:
2017-09-01
Revision:
6:0bee4b2bb400
Parent:
4:c2b09fa31492
Child:
8:c47cf4e0230c
Child:
12:9d21189a8eb0

File content as of revision 6:0bee4b2bb400:

#include "Spiral.h"

Spiral::Spiral(ikarashiMDC* spiralMotor_)
{
  spiralMotor = spiralMotor_;
  spiralMotor->braking = false;
  spiralLimit = new InterruptIn(D15);
  spiralLimit->mode(PullUp);
  spiralLimit->fall(this,&Spiral::stopRotation);
  rotating = false;
}

int Spiral::rotate()
{
  if(rotating)
    return 1;
  spiralMotor->setSpeed(0.4);
  rotating = true;
  if(spiralLimit->read() == false)
  {
  }
  return false;
}

void Spiral::stopRotation()
{
    spiralMotor->setSpeed(0);
    rotating = false;
}