Go Down

Topic: Arduini due + wifi shield ufficilae r3 con protocollo UDP (Read 2989 times) previous topic - next topic

ale16289

Jun 26, 2013, 11:50 am Last Edit: Jun 26, 2013, 12:15 pm by leo72 Reason: 1
Ciao a tutti io sto cercando di trasferire dati da un sistema composto da Arduino uno+ wifi shield ufficiale R3 ad un pc tramite un Access point.
Usando il protocollo UDP sono riuscito a tramettere con un data rate di 220 kbps.
Per incrementarlo volevo provare a sostituiere l Arduino Uno con l Arduino Due sempe usando il protocollo Udp, pero non riesco a farlo funzionare. Lerrore che mi da e il seguente anche provando ad implementare l esempio WiFi Udp send receive string.
Grazie mille in anticipo


Code: [Select]
n file included from c:\users\edit-piaf\desktop\arduino\arduino-1.5.1r2\hardware\tools\g++_arm_none_eabi\bin\../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdio.h:46,
                from C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\/utility/debug.h:13,
                from C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\WiFiClient.cpp:6:
c:\users\edit-piaf\desktop\arduino\arduino-1.5.1r2\hardware\tools\g++_arm_none_eabi\bin\../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/sys/types.h:93: error: conflicting declaration 'typedef short unsigned int u_short'
C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\utility/socket.h:71: error: 'u_short' has a previous declaration as 'typedef uint16 u_short'
C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\WiFiClient.cpp: In member function 'virtual int WiFiClient::read(uint8_t*, size_t)':
C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\WiFiClient.cpp:107: error: no matching function for call to 'ServerDrv::getDataBuf(uint8_t&, uint8_t*&, size_t*)'
C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\utility/server_drv.h:26: note: candidates are: static bool ServerDrv::getDataBuf(uint8_t, uint8_t*, uint16_t*)

lesto

Code: [Select]
no matching function for call to 'ServerDrv::getDataBuf(uint8_t&, uint8_t*&, size_t*)'
Code: [Select]
candidates are: static bool ServerDrv::getDataBuf(uint8_t, uint8_t*, uint16_t*)

il primo argomento passi un indirizzo, lui vorrebbe un valore valore

Code: [Select]
c:\users\edit-piaf\desktop\arduino\arduino-1.5.1r2\hardware\tools\g++_arm_none_eabi\bin\../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/sys/types.h:93: error: conflicting declaration 'typedef short unsigned int u_short'
C:\Users\Edit-Piaf\Desktop\Arduino\arduino-1.5.1r2\libraries\WiFi\utility/socket.h:71: error: 'u_short' has a previous declaration as 'typedef uint16 u_short'


questo sembra un problema della libreria wifi; il tipo ushort è dichiarata sia in "types.h" che in "socket.h". io eiminerei quella in "socket.h", tanto sono equivalenti.
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

PaoloP

Prova con l'IDE 1.0.5, le versioni 1.5.x sono ancora in beta.

ale16289

per quanto riguarda lesto quello che dovevo fare era aprire tutti i file socket.h e eliminare tutto quello con ushort?...se cosi non funziona lo stesso...
Mentre per quanto riguarda Paolo se uso la 1.0.5 nonm posso programmare l'Arduino Due o sbaglio?

PaoloP

Si, esatto.
Pero invece di usare la 1.5.1r2, scarica la 1.5.2 o la Nightly Builds (ovvero la 1.5.3)  :smiley-mr-green:

ale16289

l errore che vi ho riportato me lo ha dato con la 1.5.2....ora sto provando a scaricare la nightly builds e ti facccio sapere


ale16289

come hai fatto con l ide 1.5.2?... io non riesco a risolverlo e neanche con la nigtly builds...
Grazie mille..

ale16289

Scusate ma non sono ancora riuscito a implementare una trasmissione UDP con arduino due ce qualcuno che ci e riuscito e puo aiutarmi?
Grazie mille.

Federico Vanzati

#9
Jul 15, 2013, 08:27 pm Last Edit: Jul 22, 2013, 05:44 pm by Federico Vanzati Reason: 1
Immagino che hai preso la libreria dall'IDE 1.0.5 e l'hai copiata in .../hardware/arduino/sam/libraries.
Per compilare sulla due c'è bisogno di qualche modifica, in pratica solo sui tipi di dato utilizzati e sull'SPI.

Ti allego la libreria intera, che devi solo scompattare e sostituire con quella nel percorso specificato sopra.

F

ale16289

grazie ho provato a sostituire la libreria WiFi vecchia con la tua e l erroe che ottnego e il seguente:
Code: [Select]
In file included from C:\Documents and Settings\S190764\Desktop\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/WiFi.h:13,
                 from WiFiUdpSendReceiveString.ino:18:
C:\Documents and Settings\S190764\Desktop\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/WiFiServer.h:5: fatal error: wl_definitions.h: No such file or directory
compilation terminated.


comunque hai ragione prima sostituivo semplicemente la libreria wifi della versione 1.0.5

Federico Vanzati

F

ale16289

scusa ma non funziona ancora e l errore e il seguente

Code: [Select]
WiFi\utility\socket.c.o: In function `socket':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:10: multiple definition of `socket'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:10: first defined here
WiFi\utility\socket.c.o: In function `close':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:11: multiple definition of `close'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:11: first defined here
WiFi\utility\socket.c.o: In function `connect':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:12: multiple definition of `connect'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:12: first defined here
WiFi\utility\socket.c.o: In function `disconnect':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:13: multiple definition of `disconnect'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:13: first defined here
WiFi\utility\socket.c.o: In function `listen':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:14: multiple definition of `listen'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:14: first defined here
WiFi\utility\socket.c.o: In function `send':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:15: multiple definition of `send'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:15: first defined here
WiFi\utility\socket.c.o: In function `recv':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:16: multiple definition of `recv'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:16: first defined here
WiFi\utility\socket.c.o: In function `sendto':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:17: multiple definition of `sendto'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:17: first defined here
WiFi\utility\socket.c.o: In function `recvfrom':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:18: multiple definition of `recvfrom'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:18: first defined here
WiFi\utility\socket.c.o: In function `igmpsend':
C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi\utility/socket.c:20: multiple definition of `igmpsend'
WiFi\socket.c.o:C:\Documents and Settings\S190764\Desktop\ale\arduino-1.5.2-windows\arduino-1.5.2\hardware\arduino\sam\libraries\WiFi/socket.c:20: first defined here
collect2: ld returned 1 exit status


scusa  ancora per il disturbo


ale16289

E semplicemente  l esempio nella libreria wifi UDP send receive string
Comunque ecco
Code: [Select]
/*
  WiFi UDP Send and Receive String

This sketch wait an UDP packet on localPort using a WiFi shield.
When a packet is received an Acknowledge packet is sent to the client on port remotePort

Circuit:
* WiFi shield attached

created 30 December 2012
by dlf (Metodo2 srl)

*/


#include <SPI.h>
#include <WiFi.h>
#include <WiFiUdp.h>

int status = WL_IDLE_STATUS;
char ssid[] = "yourNetwork"; //  your network SSID (name)
char pass[] = "secretPassword";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

unsigned int localPort = 2390;      // local port to listen on

char packetBuffer[255]; //buffer to hold incoming packet
char  ReplyBuffer[] = "acknowledged";       // a string to send back

WiFiUDP Udp;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
 
  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while(true);
  }
 
  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:   
    status = WiFi.begin(ssid);
 
    // wait 10 seconds for connection:
    delay(10000);
  }
  Serial.println("Connected to wifi");
  printWifiStatus();
 
  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  Udp.begin(localPort); 
}

void loop() {
   
  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if(packetSize)
  {   
    Serial.print("Received packet of size ");
    Serial.println(packetSize);
    Serial.print("From ");
    IPAddress remoteIp = Udp.remoteIP();
    Serial.print(remoteIp);
    Serial.print(", port ");
    Serial.println(Udp.remotePort());

    // read the packet into packetBufffer
    int len = Udp.read(packetBuffer,255);
    if (len >0) packetBuffer[len]=0;
    Serial.println("Contents:");
    Serial.println(packetBuffer);
   
    // send a reply, to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    Udp.write(ReplyBuffer);
    Udp.endPacket();
   }
}


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}





Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy