Motor Hookup orangutan X2

Just trying to run motor test on orangutan X2 and after I build and receive no errors and connect the board and program the flash. Then deactivate the yellow led and still no motor action. Code below:

#include <avr/io.h>

int main( void ) {
for(int i=-100;i<=100;i++)
{
setMotor1(i);
delayms(2);
}
return 0;
}

Hello.

Before you can communicate with the auxiliary microcontroller, you need to call the SPIInit() function to initialize the SPI hardware:

#include <avr/io.h>
#include "SPI.h"

int main( void ) {
SPIInit();
for(int i=-100;i<=100;i++)
{
setMotor1(i);
delayms(2);
}
while (1)
  ;
return 0;

I made three changes to your code: I added a line to include the header file SPI.h, I added a call to SPIInit() before trying to set the motor speed, and I added an infinite while-loop at the end to prevent the program execution flow from running off the end of the program. In general, you never want your program to reach main’s final return statement.

You may be interested in this thread, which has some sample code for controlling motors using the X2.

- Ben

That code was used and came out with an error, for unrefernce delayms, so I changed it to delay_ms and the build ran with no errors and then Repated the same steps of connecting and only check ‘program flash’ in the auto tab and click start then deactivate the yellow led and then press reset and still no action.

Took care of it thanks.