Pages: [1]   Go Down
Author Topic: beginner programming problems  (Read 894 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25849
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...

Logged

Offline Offline
God Member
*****
Karma: 17
Posts: 723
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
God Member
*****
Karma: 17
Posts: 723
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

// 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!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26523
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
http://www.open.com.au/mikem/arduino/VirtualWire.pdf
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.
Logged

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.

Pages: [1]   Go Up
Jump to: