Timer One PWM

 #include<TimerOne.h>

           #define pwmRegister OCR1B
            const int          rmotorPin  = 10;
            const int          rdirPin       = 8 ;
            long period                       = 35000;
            long pulseWidth                = 2900  ;
            int   prescale[] = {0.1,8,64,256,1024};
            int   RESOLUTION   = 1024;
            
            void setup () {
              pinMode(rmotorPin, OUTPUT);
              pinMode(rdirPin,  OUTPUT);
              Timer1.initialize(period);
              setPulseWidth(pulseWidth);
           }

            void loop()   {
              }
             bool setPulseWidth(long microseconds)
              {
                bool ret = false;
                if(microseconds < period)
                 {
                   int duty = map(microseconds, 0,period, 0,1024);
                   if(duty < 1)
                    duty = 1;
                    if(microseconds > 0  &&duty < RESOLUTION)

                    {
                      Timer1.pwm(rmotorPin, duty);
                      digitalWrite(rdirPin, HIGH);

                      ret = true;
                    }
                  }
                   return ret;
                   delay(2600);
               }

also included is my sketch which needs help , please have a look and give your recommendations .

thanks.

sketch_aug13a.ino (4.84 KB)

Please describe the problem. If you get compile errors, include the full text of the error(s)

If you can fit the sketch in your post, put it there in code tags (the </> button) so people who view these forums on a cellphone can view it.

I'LL SEND THE POST IN THE CODE TABS AS SOON AS I TYPE IT IN . IT WILL TAKE A DAY TO PUT IT DOWN, I AM VERY SLOW AS i HAVE PALSY and I MAKE A LOT OF MISTAKES.

Telescopeman:
I'LL SEND THE POST IN THE CODE TABS AS SOON AS I TYPE IT IN . IT WILL TAKE A DAY TO PUT IT DOWN, I AM VERY SLOW AS i HAVE PALSY and I MAKE A LOT OF MISTAKES.

Huh? Copy/paste...