PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

30 行
683B

  1. // Bounce.pde
  2. // -*- mode: C++ -*-
  3. //
  4. // Make a single stepper bounce from one limit to another
  5. //
  6. // Copyright (C) 2012 Mike McCauley
  7. // $Id: Random.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
  8. #include <AccelStepper.h>
  9. // Define a stepper and the pins it will use
  10. AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
  11. void setup()
  12. {
  13. // Change these to suit your stepper if you want
  14. stepper.setMaxSpeed(100);
  15. stepper.setAcceleration(20);
  16. stepper.moveTo(500);
  17. }
  18. void loop()
  19. {
  20. // If at the end of travel go to the other end
  21. if (stepper.distanceToGo() == 0)
  22. stepper.moveTo(-stepper.currentPosition());
  23. stepper.run();
  24. }