I’m trying to utilize the multiple slave feature with the AMIS-30543 chip. I read a similar forum post from a year ago, but wasn’t able to figure it out myself from the response.
I’d like to be able to send and receive commands from one device and switch to another, which should be doable with SPI. The issue that I get is that both drivers are listening and both stepper motors move. I have the code such that each motor is governed by a separate object, however the step function
void step()
fires commands off to both motors. I have tried
void stepper1.step()
but step is not part of the AMIS library so it has no clue what to do. Where is step from? I pulled this function out of the AMIS-30543 example code as:
void step()
{
// The NXT/STEP minimum high pulse width is 2 microseconds.
digitalWrite(amisStepPin, HIGH);
delayMicroseconds(3);
digitalWrite(amisStepPin, LOW);
delayMicroseconds(3);
// The delay here controls the stepper motor’s speed. You can
// increase the delay to make the stepper motor go slower. If
// you decrease the delay, the stepper motor will go fast, but
// there is a limit to how fast it can go before it starts
// missing steps.
delayMicroseconds(2000);
}
I don’t know how to use the AMIS30543 object in conjunction with some function to step a single motor rather than both.
My code: Code.txt (4.1 KB)
This code will at the moment, move the motors simultaneously. For example I’d like to move one motor on its own for the first move, then move the other motor on its own for the second move [the step functions towards the end of the program]. Really all I need to know is how to send step commands to only a single motor.
Thanks for any help,
-Simon