Project

General

Profile

Wiki » History » Version 4

Frédéric Blanc, 2023-11-16 16:21

1 3 Frédéric Blanc
h1. accelstepper
2
3
https://www.arduino.cc/reference/en/libraries/accelstepper/
4 2 Frédéric Blanc
5 1 Frédéric Blanc
<pre><code class="cpp">
6
7
8
9
#include <AccelStepper.h>
10
11
// for the Arduino Uno + CNC shield V3 + A4988 + FL42STH47-1684A
12
13
#define MOTOR_X_ENABLE_PIN 8
14
#define MOTOR_X_STEP_PIN 2
15
#define MOTOR_X_DIR_PIN 5
16
17
AccelStepper motor_X(1, MOTOR_X_STEP_PIN, MOTOR_X_DIR_PIN); 
18
19
20
void setup()
21
{
22
  motor_X.setEnablePin(MOTOR_X_ENABLE_PIN);
23
  motor_X.setPinsInverted(false, false, true);
24
  motor_X.setAcceleration(20);  
25
  motor_X.move(200);
26
  motor_X.setMaxSpeed(100);
27
  //motor_X.setSpeed(100);
28
  motor_X.enableOutputs();
29
}
30
31
void loop()
32
{
33
  motor_X.run();
34
}
35
</code></pre>
36 4 Frédéric Blanc
37
h2. Arduino CNC Shield V3
38
39
!clipboard-202311161621-jcg62.png!
40
41
!clipboard-202311161620-ib4yo.png!
42
43
!clipboard-202311161619-rxiam.png!
44
Arduino CNC Shield Scematics V3