Go Down

Topic: Virtual wire help (Read 10 times) previous topic - next topic

CrossRoads

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.
Code: [Select]

// 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
Code: [Select]

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?
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Steen

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

Quote

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

PeterH

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 only provide help via the forum - please do not contact me for private consultancy.

CrossRoads

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

//#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
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

CrossRoads

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

justjed

Can't look myself; I'm still at 0022, but it appears to me that in VirtualWire.h, there's a #include wiring.h.
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

Riva

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
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

CrossRoads

#7
Aug 21, 2012, 01:02 am Last Edit: Aug 21, 2012, 06:16 am by CrossRoads Reason: 1
Ok, just downloaded rev 1.9.

I see this was added:
Code: [Select]

#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.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

terryking228

Quote
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???
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Riva

Quote
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.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

justjed


Quote
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?
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

Riva

Quote
You back from Italy now?

Who me?
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

terryking228

Quote
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  :) 

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
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Boffin1

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  :-(
With my mobile phone I can call people and talk to them -  how smart can you get ?

CrossRoads

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

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

http://arduino.cc/en/Main/ReleaseNotes

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

Code: [Select]

* 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
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up