You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent most of today trying to figure this question out and want to share my results
Technically it can be used, but the only 8 digital outputs of the Portenta Machine Control go through a current limiting chip and the signal edges are really slow. This means that we need to setup a huge step width, leading to a ton of CPU time wasted doing spin locks.
Also for some reason the digitalWrite function used to set the output pins does not correctly detect the pin, so we call PinNameToIndex when telling AccelStepper the pin names
#include<Arduino.h>
#include<Arduino_PortentaMachineControl.h>
#include<pinDefinitions.h>
#include<AccelStepper.h>
AccelStepper stepper(AccelStepper::MotorInterfaceType::DRIVER, PinNameToIndex(MC_DO_DO0_PIN), PinNameToIndex(MC_DO_DO1_PIN)); // Step on DO0, Dir on DO1voidsetup()
{
MachineControl_DigitalOutputs.begin();
stepper.enableOutputs();
stepper.setMinPulseWidth(130); // this is necessary. Maybe you can get it to work with something closer to 100us, but 130us seems like a safe value
stepper.setAcceleration(1000); // choose any value you want
stepper.setMaxSpeed(1000); // I wouldn't go above 1000, but values up to 1500 might work
stepper.setSpeed(100); // choose any value up to MaxSpeed
}
voidloop()
{
stepper.runSpeed();
}
No description provided.
The text was updated successfully, but these errors were encountered: