예제 #1
0
void Dome::step(long val)
{
  int move = abs(val);
  int moved = 0;
  bool hithalf = false;
  int accel = move / 2;
  
  while(move--)
  {
    if(Serial.available() > 0)
        break;
    motor.setSpeed(constrain(moved, MINSPEED, MAXSPEED));
    motor.step(1, (val > 0)?BACKWARD:FORWARD, DOUBLE);
    (val > 0)?position++:position--;
    if(!hithalf)
    {
      moved++;
      if(moved >= accel)
        hithalf = true;
    }
    else
    {
      moved--;
    }
  }
}
예제 #2
0
void setup() {
    Serial.begin(9600);           // set up Serial library at 9600 bps
    Serial.println("Stepper test!");

    motor.setSpeed(10);  // 10 rpm   

    motor.release();
    delay(1000);
    motor.step(100, BACKWARD, INTERLEAVE); 
}
예제 #3
0
//
// Constructor
// 
Dome::Dome(void)
{
  motor.setSpeed(100); // Set a default RPM of 10
  //position = 0;
}