I am trying to control a closed loop stepper and driver with a teensy 4.0. I would like to use the accelstepper library, but thus far I can't get it to move the motor. When I run the first sketch below, the motor turns with speed controlled by the delay. When I try running the example accelstepper constant speed sketch nothing happens. I have also tried sourcing 5v and dropping the voltage before it gets back to the 3v tolerant pins, but no dice. Any ideas what could be causing the issue? Thanks.
Accelstepper example:
Picture of my wiring:
Link to driver manual:
https://drive.google.com/file/d/1MvoFV1bskU-Ns0xVLWQ15e_bsfoLMbrN/view
Code:
#include <Arduino.h>
const int pulPin = 6; // PUL
const int dirPin = 7; // DIR
void setup() {
pinMode(pulPin,OUTPUT);
pinMode(dirPin,OUTPUT);
digitalWrite(dirPin,HIGH);
delayMicroseconds(5);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(pulPin,HIGH);
delayMicroseconds(200);
digitalWrite(pulPin,LOW);
delayMicroseconds(200);
}
Accelstepper example:
Code:
// ConstantSpeed.pde
#include <Arduino.h>
#include <AccelStepper.h>
AccelStepper stepper(1,6,7);
void setup()
{
stepper.setMaxSpeed(1000);
stepper.setSpeed(50);
}
void loop()
{
stepper.runSpeed();
}
Picture of my wiring:
Link to driver manual:
https://drive.google.com/file/d/1MvoFV1bskU-Ns0xVLWQ15e_bsfoLMbrN/view