Error while using Servos (ServoTimer2) with VirtualWire


i have searched whole arduino solution problem

i'm trying make 4ch rc transmitter , receiver

if project gets correct solution
i create detailed easy instructables rx , tx (will upgraded 8channels)

i experiencing error not find solution after searching whole internet 3 weeks. hence have come guys :smiley-cry:  :smiley-cry:  :smiley-cry:  :smiley-cry: 

transmitter has no issues
but receiver shows compilation problems

i want use servos virtual library
there forums advising use
<servotimer2.h>
instead of <servo.h>

but not work me
the codes

receiver:- arduino nano v3
code: [select]

#include <virtualwire.h>
#include <servotimer2.h>  //only causes error

uint8_t data[25];

void setup()
{
  serial.begin(115200); // debugging only
  serial.println("receiving");
  pinmode(13,output);
  // initialise io , isr
  //vw_set_ptt_inverted(true); // required dr3100
  vw_setup(2000); // bits per sec
  vw_set_rx_pin(8);
  vw_rx_start();       // start receiver pll running
}

void loop()
{
  uint8_t buf[vw_max_message_len];
  uint8_t buflen = vw_max_message_len;

  if (vw_get_message(buf, &buflen)) // non-blocking
  {
    int x = atoi(strtok((char*)buf, ","));  // comma, return data before it.
    int y = atoi(strtok(null, ",")); // same above
    int z = atoi(strtok(null, ".")); // period, return data before it.
    serial.print(x); // x axis
    serial.print(", ");
    serial.print(y); // y axis
    serial.print(", ");
    serial.print(z); // z axis
    serial.println();
  }
}



transmitter:
code: [select]
#include <virtualwire.h>

char array[20];
int x,y,z;

void setup()
{
  serial.begin(115200);  // debugging only
  serial.println("sending"); // debugging only

  // initialise io , isr
  //vw_set_ptt_inverted(true); // required dr3100
  vw_setup(2000); // bits per sec
  vw_set_tx_pin(33); //rf sending pin
 }

void loop()
{
  x = analogread(a14),410,345,0,255)
  y = analogread(a15),415,275,0,255)
  z = analogread(a13),310,410,0,255)
 
  sprintf(array, "%d,%d,%d.",x,y,z);
  vw_send((uint8_t*)array, strlen(array));
  vw_wait_tx();
}



i'm still intermediate
i kindly request guys me if wish


quote
but not work me
well, that's pretty lame. happens. have not said happens. having compilation errors? linker errors? upload errors? smoke pouring out of ears? bad breath?


Arduino Forum > Using Arduino > Programming Questions > Error while using Servos (ServoTimer2) with VirtualWire


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor