i'm having problems - got a set of the simple one direction transmitter & receiver- built the boards, that went fine & i think it's all done right, i have a strong electronic background. i am new to arduino programming, so im likely to ask some simple questions...
' ' not declared in this scope i get a lot of these errors, & want to know what it means & what to do
also, i'm trying to use #include <VirtualWire.h> this is the fist thing in the sketch. i get error message VirtualWire.h: no such file or directory
what does this mean & what to do?
i'm very new at this & these are likely simple questions, so i apologize in advance...one more thing - i got the sketch from the arduino cookbook, is this book fairly up to date, or is there something better i should be reading? is there anywhere i can get a copy of a sketch to send wireless from one arduino to the other,have it print on serial monitor the sending unit has a photo resistor for input, & would like it to transmit when a certain threshold is reached- should be quite simple. i've already done all the basic sketches successfully
thanks for your help!
virtualwire is not part of the installation; it has to be downloaded.
If you've worked through the examples, you should not be getting scope errors.
You need to post code.
you 1st need to download and install the library
you can do that by downloading it from here: http://letsmakerobots.com/node/12336
Extract it and copy paste the VirtualWire folder in your arduino/libraries folder
Hope it helps...
Variable scope has to do with where, in which functions, and when a variable exists. For instance, if you declare a variable inside a function, then it can only be used inside that function.
Google C++ and scope and you should find more than you ever wanted to know.
Delta_G:
Variable scope has to do with where, in which functions, and when a variable exists. For instance, if you declare a variable inside a function, then it can only be used inside that function.Google C++ and scope and you should find more than you ever wanted to know.
Lol, you don't need to do that just download and install the library and you'l be fine.
I thought he was talking about two different errors. I was talking about the first, which I gathered wasn't part of the library problem.
Delta_G:
I thought he was talking about two different errors. I was talking about the first, which I gathered wasn't part of the library problem.
Sorry I didn't see that. Its an error in his code. @angleofphase you need to post your code.
// 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@open.com.au)
// 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
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the 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 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*, HEX);*
- Serial.print(" ");*
- }*
- Serial.println("");*
- digitalWrite(13, false);*
- }*
}
here is a copy of my code for the receiver; i figured out from some of the other responses that i need to download vitualwire to the arduino lib, i found the download. but am unclear as to where i put it. remember i'm new at this - it's fascinating & i want to learn. any help will be greatly appreciated!
thought i'd ask, does anyone have a sketch (sender & receiver) that they would be willing to share? i still want to learn the programming, but if i had a working code, i could compare & find out what i did wrong thanks
but if i had a working code, i could compare & find out what i did wrong thanks
If you haven't got the library installed in the right place, working code isn't going to help you.
got a set of the simple one direction transmitter & receiver- built the boards, that went fine & i think it's all done right
Well, this is useful information. Good thing you didn't get the complicated version.
Some details might be useful.
I don't have my laptop here, but I think the library needs to be at a pretty level.
Check your directory - I think they are at
c:\arduiono-0022\libraries (use your particular path)
or perhaps
c:\arduiono-0022\arduino\libraries
I don't think they are buried down in the bowels of the folders.
Working sketch - did you follow this?
When I used it the first time I just followed the code in 5.1 and 5.2 using the standard pins, worked great.
I see folks always adding this line
vw_set_ptt_inverted(true); // Required for DR3100
If your transmitter does not have a PTT pin, do not put this line in.
The really simple TX units don't have one - they only transmit when data is sent to it on the data pin.