VirtualWire Library

I’m getting this error while compiling… Can someone tell me why it is like this?

#include <VirtualWire.h>

const int led_pin = 11;
const int transmit_pin = 12;
const int receive_pin = 2;
const int transmit_en_pin = 3;

void setup()
{
  // Initialise the IO and ISR
  vw_set_tx_pin(transmit_pin);
  vw_set_rx_pin(receive_pin);
  vw_set_ptt_pin(transmit_en_pin);
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);	 // Bits per sec
}

byte count = 1;

void loop()
{
  char msg[7] = {'h','e','l','l','o',' ','#'};

  msg[6] = count;
  digitalWrite(led_pin, HIGH); // Flash a light to show transmitting
  vw_send((uint8_t *)msg, 7);
  vw_wait_tx(); // Wait until the whole message is gone
  digitalWrite(led_pin, LOW);
  delay(1000);
  count = count + 1;
}

In file included from sketch_mar06a.ino:1:
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:59: error: variable or field ‘vw_set_tx_pin’ declared void
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:59: error: ‘uint8_t’ was not declared in this scope
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:63: error: variable or field ‘vw_set_rx_pin’ declared void
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:63: error: ‘uint8_t’ was not declared in this scope
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:67: error: variable or field ‘vw_set_ptt_pin’ declared void
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:67: error: ‘uint8_t’ was not declared in this scope
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:71: error: variable or field ‘vw_set_ptt_inverted’ declared void
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:71: error: ‘uint8_t’ was not declared in this scope
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:76: error: variable or field ‘vw_setup’ declared void
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:76: error: ‘uint16_t’ was not declared in this scope
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:90: error: ‘uint8_t’ does not name a type
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:98: error: ‘uint8_t’ does not name a type
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:104: error: ‘uint8_t’ does not name a type
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:107: error: ‘uint8_t’ does not name a type
C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:112: error: ‘uint8_t’ does not name a type
sketch_mar06a.ino: In function ‘void setup()’:
sketch_mar06a:11: error: ‘vw_set_tx_pin’ was not declared in this scope
sketch_mar06a:12: error: ‘vw_set_rx_pin’ was not declared in this scope
sketch_mar06a:13: error: ‘vw_set_ptt_pin’ was not declared in this scope
sketch_mar06a:14: error: ‘vw_set_ptt_inverted’ was not declared in this scope
sketch_mar06a:15: error: ‘vw_setup’ was not declared in this scope
sketch_mar06a.ino: In function ‘void loop()’:
sketch_mar06a:26: error: ‘vw_send’ was not declared in this scope

Your Virtualwire library can't be found by the IDE. Put the VW folder in the sketch "libraries" folder.

it's in C:\Users\ahmed\Documents\Arduino\libraries\VirtualWire already it says vw_set_tx_pin was not declared in this scope

Is it double foldered?

VitrualWire folder: { Examples something.cpp something.h }

No single folder

Then try moving it to the IDE folder >> libraries and see if that makes a difference.

You did unzip the virtualwire download, yes?

Once you get past the compile problem, you likely do not need these 2 lines

vw_set_ptt_pin(transmit_en_pin); vw_set_ptt_inverted(true); // Required for DR3100

Most 315/433 MHz transmitters do not have a Push To Talk pin. The transmitter just goes inactive when no data is present on the data pin. Same for the receive side when you get there.

I has the same problem until I downloaded / installed V1.14 of library Go for it.....

Hi, try this:

#include <VirtualWire.h>

int led_pin = 11;
int transmit_pin = 12;
int receive_pin = 2;
int transmit_en_pin = 3;

void setup()
{
  // Initialise the IO and ISR
  vw_set_tx_pin(transmit_pin);
  vw_set_rx_pin(receive_pin);
  vw_set_ptt_pin(transmit_en_pin);
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);	 // Bits per sec
}

byte count = 1;

void loop()
{
  char msg[7] = {'h','e','l','l','o',' ','#'};

  msg[6] = count;
  digitalWrite(led_pin, HIGH); // Flash a light to show transmitting
  vw_send((uint8_t *)msg, 7);
  vw_wait_tx(); // Wait until the whole message is gone
  digitalWrite(led_pin, LOW);
  delay(1000);
  count = count + 1;
}

Just remove “const”
regards,
Gnux

These are not needed if the Transmitter does not have a Push To Talk pin. The Receiver will certainly not.

vw_set_ptt_pin(transmit_en_pin); vw_set_ptt_inverted(true); // Required for DR3100