Virtual wire help

I've used Virtualwire before, am trying to get it working again in 1.0.1.

I've copied the Virtualwire library into the c:\Arduino-1.0.1\libraries folder,
and checked Sketch:Import Library:VirtualWire was showing up

When I compile the sample Tx sketch I get these errors.

// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@open.com.au)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.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
    vw_setup(2000);	 // Bits per sec
}

void loop()
{
    const char *msg = "hello";

    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    delay(200);
}

Compiling yields this

C:\Arduino-1.0.1\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=101 -IC:\Arduino-1.0.1\hardware\arduino\cores\arduino -IC:\Arduino-1.0.1\hardware\arduino\variants\standard -IC:\Arduino-1.0.1\libraries\VirtualWire C:\Users\Owner\AppData\Local\Temp\build2811771902139116391.tmp\sketch_aug18a.cpp -o C:\Users\Owner\AppData\Local\Temp\build2811771902139116391.tmp\sketch_aug18a.cpp.o 
In file included from sketch_aug18a.cpp:11:
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:14:20: warning: wiring.h: No such file or directory
In file included from sketch_aug18a.cpp:11:
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:59: warning: 'vw_set_tx_pin' initialized and declared 'extern'
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:59: error: variable or field 'vw_set_tx_pin' declared void
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:59: error: 'uint8_t' was not declared in this scope
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:63: warning: 'vw_set_rx_pin' initialized and declared 'extern'
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:63: error: variable or field 'vw_set_rx_pin' declared void
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:63: error: 'uint8_t' was not declared in this scope
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:67: warning: 'vw_set_ptt_pin' initialized and declared 'extern'
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:67: error: variable or field 'vw_set_ptt_pin' declared void
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:67: error: 'uint8_t' was not declared in this scope
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:71: warning: 'vw_set_ptt_inverted' initialized and declared 'extern'
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:71: error: variable or field 'vw_set_ptt_inverted' declared void
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:71: error: 'uint8_t' was not declared in this scope
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:76: warning: 'vw_setup' initialized and declared 'extern'
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:76: error: variable or field 'vw_setup' declared void
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:76: error: 'uint16_t' was not declared in this scope
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:90: error: 'uint8_t' does not name a type
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:98: error: 'uint8_t' does not name a type
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:104: error: 'uint8_t' does not name a type
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:107: error: 'uint8_t' does not name a type
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:112: error: 'uint8_t' does not name a type
sketch_aug18a.cpp: In function 'void setup()':
sketch_aug18a:18: error: 'vw_set_ptt_inverted' was not declared in this scope
sketch_aug18a:19: error: 'vw_setup' was not declared in this scope
sketch_aug18a.cpp: In function 'void loop()':
sketch_aug18a:27: error: 'vw_send' was not declared in this scope

This line seems to be the start of the problem:
C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:14:20: warning: wiring.h: No such file or directory

however,
C:\Arduino-1.0.1\libraries\VirtualWire\VirtualWire.h is definitely there.

I closed the IDE down, restarted, no help. What am I doing wrong?

if you look closely it's not about the virtualwire lib, but about the wiring lib (wiring.h) that is not present somewhere

C:\Arduino-1.0.1\libraries\VirtualWire/VirtualWire.h:14:20: warning: wiring.h: No such file or directory

In version 1 of the IDE, the standard include files were renamed. This means you will either need to change the #include statements, or provide your own .h that includes the new ones.

(Yeah, it strikes me as a monumentally daft thing to do too, but I imagine there must have been some reason for it.)

I tried this change from the release notes. Same errors, don't think I have quite the right approach yet...

//#include <Wire.h>

#include <VirtualWire.h>   // Wireless transmitter/receiver library

  #if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #else
  #include "WProgram.h"
  #endif


// RF Link Transmitter - Sparkfun MO-SAWR-A, 434MHz, WRL-08946

// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with RF module. 

// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@open.com.au)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

// uses default pin 12 for transmit data
// uses default pin 11 for receive data

// end of notes
// ***********************************************************************

byte ledPin = 13;
// create an array to store data to be sent out
char msg[10]; // extra char added for address

byte analogvalue1;
byte analogvalue2;
byte analogvalue3;
byte analogvalue4;

// ***********************************************************************
// set up the pins as Inputs, Outputs, etc.
void setup()
{
  /* Setup the pin directions, write inputs High to turn on internal pullups */
  pinMode (ledPin, OUTPUT);

  // Initialise the IO and ISR for VirtualWire
  vw_setup(2000);	                      // Bits per sec

}                                            // end of void Setup()

// ***********************************************************************
// Main loop for reading the keypad and sending the button pushed out
// (with a unique address to be added eventually by reading 0-F from currently unused pins)

void loop()
{
  // add your code here to read in the 4 analog values
  //
  //

  // now put the data into an array with a couple of sync bytes

  msg[0] = 'b';
  msg[1] = 4;
  msg[2] = highByte (analogvalue1);
  msg[3] = lowByte (analogvalue1);
  msg[4] = highByte (analogvalue2);
  msg[5] = lowByte (analogvalue2);
  msg[6] = highByte (analogvalue3);
  msg[7] = lowByte (analogvalue3);
  msg[8] = highByte (analogvalue4);
  msg[9] = lowByte (analogvalue4);

  digitalWrite(ledPin, true);               // Flash a light to show transmitting

  vw_send((uint8_t *)msg, strlen(msg));     // send the character out

  vw_wait_tx();                             // Wait until the whole message is gone

  digitalWrite(ledPin, false);              // turn off the flash of LED

}                                             // end of void loop

Bump

Can't look myself; I'm still at 0022, but it appears to me that in VirtualWire.h, there's a #include wiring.h.

Hi CrossRoads,
I just downloaded the latest Virtualwire library from here http://www.open.com.au/mikem/arduino/ and it compiled without problem in 1.0.1

Ok, just downloaded rev 1.9.

I see this was added:

#if (ARDUINO < 100)
#include "WProgram.h"
#endif
#include "VirtualWire.h"
#include <util/crc16.h>

so I'll go back to my experiment again.

Edit:
Confirmed, that solved it. Oddly, I couldn't just rename the existing virtualwire to virtualwire_old, and have the new virtualwire in the same arduino/libraries folder. 1.0.1 kept pulling files from \virtualwire-old! Must be a benefit of only compiling the unchanged code.
Deleting the old folder took care of it.

I couldn't just renanem the existing virtualwire to virtualwire_old, and have the new virtualwire in the same arduino/libraries folder. 1.0.1 kept pulling files from \virtualwire-old!

Hi Robert... I got burned with that same old/new library thing; wasted hours..

It's SUPPOSED to be possible to delete the compiled library code, but what/where???

It's SUPPOSED to be possible to delete the compiled library code, but what/where???

That's a question I would also like to know the answer for. I have also had problems with updating libraries and finding they still show the same errors.

terryking228:

I couldn't just renanem the existing virtualwire to virtualwire_old, and have the new virtualwire in the same arduino/libraries folder. 1.0.1 kept pulling files from \virtualwire-old!

Hi Robert... I got burned with that same old/new library thing; wasted hours..

It's SUPPOSED to be possible to delete the compiled library code, but what/where???

Interesting. I haven't dug into the depths of the IDE, but yeah, you'd think there's some sort of make-like functionality someplace.

You back from Italy now?

You back from Italy now?

Who me?

You back from Italy now?
Who me?

OH: Me...

Yes I am 'permanently' back home in rural Vermont USA after 8 great years in which my wife designed/ran libraries in International schools in Africa, China, Saudi Arabia and Italy and I did electronics/Arduino and online Educational stuff (http://arduinoinfo.info)

We had a great experience, met many wonderful people who were very much (As they say in Vermont) "Not From Around Here". A shepherd grazing goats in the ruins of a Roman era city in North Africa, Berber kids running barefoot through the Sahara, 86 year old Chinese farmer working in the fields every day, Chinese kid with a mohawk in a downtown disco, Saudi Electrical Engineering professor with 3 wives, Italian woman teaching kids Arduino Sumo robots on the second floor of an old palace in Italy. Wow. Couple Photos:
http://goo.gl/Fxi5q http://goo.gl/YWnkQ http://goo.gl/ybg2o http://goo.gl/Bpfx5

I loved China, especially the rural villages. The Shenzhen Electronics Marketplace is awesome: 900 shops in one building and 1000 more within 5 km. My Chinese friend Jun Peng and I started Yourduino.com to sell parts that we could give great prices on. The secret to getting the best price in the world: Be friendly, speak Chinese, walk into the shop or factory with RMB Cash in your hand. Negotiate. Big companies with purchase orders can never get that price :slight_smile:

Now.. where the heck is the pre-compiled part of a library??? I HEARD about this. I'll keep looking...

And I really appreciate this Community and you people who have been with me online, from everywhere!

Regards, Terry King ...In The Woods in Vermont, USA

Geez Terry

What an experience, I want to do that, but where do you find such a wife ?

No, back to the topic that Bob raised, I was tempted to look at upgrading to v1.whatever, I put it off because of the initial hassles with libraries , that I felt were out of my depth.

I have been busy 24/7 for the last few months, but nearly caught up , so I was going to check through the forum to see if the migration ( from 23 to 0.1 ) had been sweetened, but now I am even more wary if you experienced guys are getting hassles .

Why can't they leave well alone, if it ain't broke dont fix it ! ...................

Or perhaps its a case of teaching an old dog new tricks :frowning:

Virtualwire was solved easily enough - I just removed the old folder.

The new one addresses this stuff from the 1.0 release notes.

I imagine other popular 'user' libraries have been updated also.

* The WProgram.h file, which provides declarations for the Arduino API,
  has been renamed to Arduino.h. To create a library that will work in
  both Arduino 0022 and Arduino 1.0, you can use an #ifdef that checks
  for the ARDUINO constant, which was 22 and is now 100.  For example:

  #if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #else
  #include "WProgram.h"
  #endif

terryking228:
Couple Photos:
http://goo.gl/Fxi5q http://goo.gl/YWnkQ http://goo.gl/ybg2o http://goo.gl/Bpfx5

Hey, nothing like playing around with the next button. Nice stone arch.

Nice stone arch.

The Arch: http://goo.gl/xqcL4

The coolest thing about that Roman arch is it was out in the middle of a farmer's field in a a very rural area of Tunisia, North Africa. No signs, no protection. The rest of the building had fallen to stones all around. The Romans knew how to cut the arch stones so there was no side-force on any joint! They had technology that was lost for 1000 years before the Renaissance, like great concrete that stands up even today. I lived near the Carthage aqueduct and the storage cisterns. Some of those 2000 year old aqueduct sections were in perfect shape.

And to those who think we may have possibly gone off topic, my favorite quote on the subject:

"Humans are only off-topic if they are dead"! :slight_smile:

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

Should be able to connect crossly (12 to 11, 11 to 12).

I tried that. But, in serial window, no data is shown.. . I cant continue my project till this is solved.. Please help me. Deadline is closing