URGENT HELP IN VIRTUAL WIRE NEEDED, FOR MAIN PROJECT COMPLETION

Guys, I am using virtual wire for my project. I have connected the digital pins 11 and 12 (I read they are by default. So connected so crossly to 2 arduino nano's. I have loaded the virtual wire simple transmit & receive program to the nano's. But, I am not getting any response in the serial window of receiver nano. Can i directly connect the 12 & 11 pins crossly in the arduinos or do I have to use RF for sending ? Please someone reply as soon as possible. I cant continue the project as I am stuck here.

My, block diag is attached below

Hi, if you are just connecting them by wires at the moment, have you got the gnd of both arduino connected together?
A current return path will be required for direct connections.

Good to see you have started the project stage by stage, hope we can help.

Tom.... :slight_smile:

fast connection can be obtained with "shiftin"/"shiftout" (see the arduino reference)
you can also use the Softwareserial lib.

Thanks guys.. it worked when i connected the grnds together.
But, i wish to do it wirelessly.

But, using virtual wire, I am getting (at random times) data at rxr nano only when i change the sensor positions. Else no data.

Also, I cant use virtual wire and servo header files together at reciever. Its generating error during compilation. So, I used software serial. Its also generating error..

My program is: (only partial. need to include servo write details)

#include <SoftwareServo.h>

//Connect the Receiver data pin to Arduino pin 11

#include <VirtualWire.h>

byte message[4]; // a buffer to hold the incoming messages
byte msgLength = 4; // the size of the message
byte accel_pitch;
byte accel_roll;
byte gyro_yaw;
byte gyro_pitch;

void setup()
{
Serial.begin(19200);
Serial.println("Ready");

// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
}

void loop()
{
if (vw_get_message(message, &msgLength)) // Non-blocking
{
for (int i = 0; i <msgLength; i++)
{
Serial.print(message*);*
Serial.print("\t");

  • }*
    Serial.println();
  • }*
  • accel_pitch = message[0];*
  • accel_roll = message[1];*
  • gyro_yaw = message[2];*
  • gyro_pitch = message[3];*

}
----
On compiling:
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Program Files\Arduino\hardware\arduino\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\variants\eightanaloginputs -IF:\arduino libs\libraries\SoftwareServo -IF:\arduino libs\libraries\VirtualWire C:\Users\roy\AppData\Local\Temp\build8637042207630295898.tmp\sketch_jan06b.cpp -o C:\Users\roy\AppData\Local\Temp\build8637042207630295898.tmp\sketch_jan06b.cpp.o
In file included from sketch_jan06b.ino:1:
F:\arduino libs\libraries\SoftwareServo/SoftwareServo.h:4:22: warning: WProgram.h: No such file or directory
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Program Files\Arduino\hardware\arduino\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\variants\eightanaloginputs -IF:\arduino libs\libraries\SoftwareServo -IF:\arduino libs\libraries\VirtualWire -IF:\arduino libs\libraries\SoftwareServo\utility F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp -o C:\Users\roy\AppData\Local\Temp\build8637042207630295898.tmp\SoftwareServo\SoftwareServo.cpp.o
In file included from F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:1:
F:\arduino libs\libraries\SoftwareServo/SoftwareServo.h:4:22: warning: WProgram.h: No such file or directory
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'uint8_t SoftwareServo::attach(int)':
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:27: error: 'digitalWrite' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:28: error: 'OUTPUT' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:28: error: 'pinMode' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'void SoftwareServo::write(int)':
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:51: error: 'clockCyclesPerMicrosecond' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp: In static member function 'static void SoftwareServo::refresh()':
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:73: error: 'millis' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:106: error: 'digitalWrite' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:108: error: 'TCNT0' was not declared in this scope
F:\arduino libs\libraries\SoftwareServo\SoftwareServo.cpp:123: error: 'digitalWrite' was not declared in this scope

My transmit program is..: (i am using MPU 6050 sensor)

added as attachment

sketch_jan06a.ino (9.91 KB)

Please don't cross-post - it wastes time.

AWOL,
I posted my 2nd program as attachment because, forum restricts no of words to upto 9000 or so. My program is more than that.
Please pardon me.

One of your error messages refers to WProgram.h not being defined. What you need to do is change the virtual wire library.
You a text editor like notepad or word, and change #include to #include <Arduino.h>.

Save it and restart the Arduino software.

Most of that looks like the libraries are not in the right place.

Then, I would make the code more like the example:

// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <VirtualWire.h>
void setup(){    
Serial.begin(9600); 
// Debugging only    
Serial.println("setup");    
// Initialise the IO and ISR    
vw_set_ptt_inverted(true);  // Required for DR3100    - delete if your Tx has no PTT input
vw_setup(2000);      // Bits per sec    
vw_rx_start();       // Start the receiver PLL running
}
void loop(){    
uint8_t buf[VW_MAX_MESSAGE_LEN];    // <<<<<<<< this is different
uint8_t buflen = VW_MAX_MESSAGE_LEN;   // <<<<<< this s different

 if (vw_get_message(buf, &buflen)) // Non-blocking    
{       
 int i;        
digitalWrite(13, true); // Flash a light to show received good message        
// Message with a good checksum received, dump it.        
Serial.print("Got: ");                
for (i = 0; i < buflen; i++)        
{            
Serial.print(buf[i], HEX);            
Serial.print(" ");        
}        
Serial.println("");        
digitalWrite(13, false);    
}
}