Arduino and Motor

Good morning

I need to command a motor with my Arduino I don't know the name of the motor, but I have a Pololu ssc03a as PWM and a Smart Control 20 Hype as regulator (I do not know if the term is right)

I think the problem is on the regulator, but I don't have the user guide and the site of Hype is only in German

I have to do something to use the regulator?

Excuse me for my bad English, I'm Italian

I’m guessing that the ESC (Electronic Speed Controller = regulator = Smart Control 20 Hype ) is wanting to talk R/C servo pulses (PPM).
If you’re feeding it PWM, it probably doesn’t like it.
Try using the servo library and commanding the ESC that way.

Hi AWOL, thank you very much for your help

but I don’t know well Arduino, so I tried this code:

void setup()// run once, when the sketch starts
{
   Serial.begin(9600);// set up Serial library at 9600 bps
}

void put(int servo, int angle)
{//servo is the servo number (typically 0-7)
//angle is the absoltue position from 500 to 5500

   unsigned char buff[6];

   unsigned int temp;
   unsigned char pos_hi,pos_low;
   
   temp=angle&0x1f80;
   pos_hi=temp>>7;
   pos_low=angle & 0x7f;

   buff[0]=0x80;//start byte
   buff[1]=0x01;//device id
   buff[2]=0x04;//command number
   buff[3]=servo;//servo number
   buff[4]=pos_hi;//data1
   buff[5]=pos_low;//data2

   for(int i=0;i<6;i++){
      Serial.print(buff[i],BYTE);
   }
}

void loop()// run over and over again
{
   put(0,3000);
}

this is the code with the protocol of the PWM board, Pololu ssc03a

I have to use a different code with the servo library?

Sorry, I misunderstood - I thought the Pololu was a PWM speed controller.

I'd try driving the ESC directly from the Arduino using the servo library. That way, you're not debugging two different interfaces, when you've got no way of checking if they're working.

Try to test your setup using a servo, if you've got one.

This code would position a servo (or give half throttle to an ESC)connected to pin 9

#include <Servo.h>

Servo myServo;

void setup()// run once, when the sketch starts
{
   Serial.begin(9600);// set up Serial library at 9600 bps
   myServo.attach(9);  // attaches the servo on pin 9 to the servo object 
}

void loop()// run over and over again
{
   put(0,3000);  // the pololu expects the value in microseconds times 2, this is 1500us (90 degrees for most servos)
   myServo.writeMicroseconds(1500); //  this gives an angle of 90 degrees    
}

I got an error trying to upload this code. It said 'put' was not declared in this scope.

If you are not using the pololu controller you can remove the line calling the put function. Otherwise the code needs to be used with the put function given in reply #2 .

Works great, thanks!