ServoTimer2 Does not Write to Servo!

Hey there, im controlling three servos at once using a cheap RF 433MHz Rx/Tx module…

im using virtualwire.h and servotimer2.h to avoid the interrupt conflict and i had to comment out the “typedef bool” code to aboid the bool uint8_t error.

when i Seriel.print the values that are written to the servos, they show up on the monitor correctly, although those exact values are in a myservo.write(value) function and they do not budge!

extra info, servos are powered by a 3s LiPo which is going through a sBEC which delivers constant 6V and 5A max, servos are 3 feather Hitc Hs-55.

any thoughts or nuggets of knowledge is greatly appreciated <3

Rx Code

#include <ServoTimer2.h>
#include <VirtualWire.h>

ServoTimer2 myservo1;  // create servo object to control a servo
ServoTimer2 myservo2;  // create servo object to control a servo
ServoTimer2 myservo3;  // create servo object to control a servo

int mapout1, mapout2, mapout3;
float mapout1_filter;       //filter coeff
const int n = 5;

void setup()
  vw_setup(6200);   // Bits per sec
  vw_rx_start();       // Start the receiver PLL running

  myservo1.attach(9);  // attaches the servo on pin 9 to the servo object

  myservo1.write(90);     //init position
  myservo2.write(90);     //init position
  myservo3.write(180 / 2); //init position


void loop()

    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) //receives values from other arduino ( 3 values = 6 bytes, each value has its own byte for polarity)

      values[0] = buf[0];
      values[1] = buf[2];
      values[2] = buf[4];

  mapout1 = map(values[0], 0, 180, 3, 100);    

  mapout1_filter = (mapout1_filter * (n - 1) + mapout1) / n; // filter test



  mapout2 = map(values[1], 0, 180, 170, 10);

  mapout3 = map(values[2], 0, 180, 180, 0);

  Serial.print(" ");
     Serial.print(" ");



IIRC the servoTimer2 library requires values in micro seconds - like the standard Servo.writeMicroseconds().

0 deg would be about 1000, 90 deg about 1500 and 180 deg about 2000 microsecs.


Why doesn't the sender just send the values needed? Why do you need to f**k around manipulating the values sent?

Why does the sender send 6 bytes when you only need three?

Thanks Robin! didnt know the timer2 library required the pwm times where as the standrd library used degrees!

@paul, im giving the sender 3 values to send, but the code adds one byte to each value for the polarity, meaning + or - which would be 0 or 255.

sender gets (value, value, value) ---> 8 bit value ---> receiver gets (value, polarity, value, polarity, value, polarity).

i havnt been able to prevent those polarity bytes from popping up!

thanks for the responses