Pages: [1] 2   Go Down
Author Topic: Arduini due + wifi shield ufficilae r3 con protocollo UDP  (Read 1484 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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*)
« Last Edit: June 26, 2013, 05:15:30 am by leo72 » Logged

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10105
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Cagliari, Italy
Offline Offline
Tesla Member
***
Karma: 103
Posts: 6572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code fast. Code easy. Codebender --> http://codebender.cc/?referrer=PaoloP

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Cagliari, Italy
Offline Offline
Tesla Member
***
Karma: 103
Posts: 6572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Code fast. Code easy. Codebender --> http://codebender.cc/?referrer=PaoloP

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Stesso problema, risolto con IDE 1.5.2 smiley-wink
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Milano, Italy
Offline Offline
Edison Member
*****
Karma: 15
Posts: 1163
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* WiFi_due.zip (49.79 KB - downloaded 17 times.)
« Last Edit: July 22, 2013, 10:44:50 am by Federico Vanzati » Logged

F

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

grazie ho provato a sostituire la libreria WiFi vecchia con la tua e l erroe che ottnego e il seguente:
Code:
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
Logged

Global Moderator
Milano, Italy
Offline Offline
Edison Member
*****
Karma: 15
Posts: 1163
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ho aggiornato lo zip nel messaggio sopra
Logged

F

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

scusa ma non funziona ancora e l errore e il seguente

Code:
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
Logged

Cagliari, Italy
Offline Offline
Tesla Member
***
Karma: 103
Posts: 6572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ale, puoi allegare lo sketch che utilizzi?
Logged

Code fast. Code easy. Codebender --> http://codebender.cc/?referrer=PaoloP

Offline Offline
Jr. Member
**
Karma: 1
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

E semplicemente  l esempio nella libreria wifi UDP send receive string
Comunque ecco
Code:
/*
  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");
}



Logged

Pages: [1] 2   Go Up
Jump to: