Pages: [1]   Go Down
Author Topic: Ethernet + Virtual Wire Issues  (Read 1421 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,
I'm try to use a virtual wire with arduino shield:

virtual wire :
- tx pin: 12
- rx pin: 11

When I compile the sketches I received this issues:

Servo/Servo.cpp.o: In function `__vector_11':
/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/Servo.cpp:103: multiple definition of `__vector_11'
VirtualWire/VirtualWire.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/VirtualWire/VirtualWire.cpp:416: first defined here

My understanding is that there is a issues with the pin 11 I've tried to check "servo.cpp" and "VirtualWire.cpp" but I didn't found nothing,

is there someone  that know how to fix that ?

thanks in advance ,
Gnusso

Logged

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

The Ethernet shield is an SPI device. It uses pins 11, 12, and 13 for SPI purposes. It uses pins 4 and 10 as slave select pins. None of those pins is available for your application to use.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks very much for your reply,
from your stand point is there the possibility to modify the tx and rx of Virtualwire library ?

-regards-
Andrea
Logged

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

Quote
from your stand point is there the possibility to modify the tx and rx of Virtualwire library ?
The VirtualWire library has two methods, vw_set_tx_pin and vw_set_rx_pin, that allow you to use any pins you want. The defaults are 12 and 11, but you can change them by calling these functions. You also need to call vw_set_ptt_pin to get off pin 10.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great, I've tried to call the setup but I didn't call the last one that you have said ... now I try and I'll let you know ;-)

Andrea
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again,
I've tried to modify the code followint your suggestion maybe im wrong something ? following the code ... I've called the function after vw_setup ...
Code:
#include <VirtualWire.h>
#include <SPI.h>
#include <Ethernet.h>

#include <Servo.h>
Servo myservo;  // create servo object to control a servo

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x8D, 0x64 }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString;

//////////////////////

void setup(){
  Serial.begin(9600);
  vw_setup(1200);
  vw_set_tx_pin(2);
  vw_set_rx_pin(3);
  vw_set_ptt_pin(5);
  pinMode(8, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  myservo.write(90); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo co
  //enable serial data print
  
  Serial.println("server LED test 1.0"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string
          readString += c;
          //Serial.print(c);
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging

          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Test Button</H1>");
          
          client.println("<a href=\"/?on\"\">ON</a>");
          client.println("<a href=\"/?off\"\">OFF</a>");

          client.println("</BODY>");
          client.println("</HTML>");
 
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
          {
            myservo.write(40);
          
            char msg[1];
            msg[0] = '1';
      
            vw_send((uint8_t *)msg, strlen(msg));  // invia la lettera a
        
            Serial.println("Led On");
    
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            myservo.write(140);
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}


The exact error is this:
Servo/Servo.cpp.o: In function `__vector_11':
/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/Servo.cpp:103: multiple definition of `__vector_11'
VirtualWire/VirtualWire.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/VirtualWire/VirtualWire.cpp:416: first defined here



warm regards
Andrea
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,
the problem is that ... looking Servo.cpp: (line 103) and VirtualWire.cpp (line 416) that function SIGNAL (TIMER1_COMPA_vect) is present in both ...

Then I've change the function in VirtualWire.cpp putting SIGNAL (TIMER6_COMPA_vect) because the other one arrive until 5 ... in compile mode there is no problem ... but I've note that the serial monitor is not working anymore ...due the fact putting back like initial the serial monitor can works ...

How I can do to remove the issues and continue to work ?? SIGNAL (TIMER1_COMPA_vect)  maybe is call in other parte that I didn't know ... I can try to modify to the servo.cpp part ?

Thanks for the support,
Andrea
Logged

Pages: [1]   Go Up
Jump to: