Wifi shield probleem

Arduino shields
Berichten: 8
Geregistreerd: 24 Feb 2014, 19:30

Wifi shield probleem

Berichtdoor AukevanderVeen » 24 Aug 2014, 13:42

Hallo als nieuweling in deze materie loop ik tegen het volgende probleem aan.
Ik heb mijn wifishield gemonteerd op mijn mega. En een brug gemaakt volgens de arduino site, de sketch van Tom Igoe geupload.
Sleutel en code aangepast en het groene ledje op het shield brand ten teken van een verbinding.
Tot zover gaat het goed. Echter krijg ik met geen mogelijkheid het boardje ergens zichtbaar. Alle beschikbare ip codes van de DHCP client devices in de adresbalk geprobeerd maar tot nu toe zonder resultaat. Wat doe ik fout??

Advertisement

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Wifi shield probleem

Berichtdoor nicoverduin » 24 Aug 2014, 15:28

Wat je fout doet: is ons onvolledige info geven:
a) welke wifi shield
b) Tom Igoe heb ik nog nooit van gehoord dus wat hij doet/laat zien ken ik niet.
c) de links verschaffen waar je allemaal hebt gekeken
d) Waar/hoe heb je gekeken naar het boardje....
M.a.w. ik heb nog geen idee wat je nu precies wilt...
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 8
Geregistreerd: 24 Feb 2014, 19:30

Re: Wifi shield probleem

Berichtdoor AukevanderVeen » 24 Aug 2014, 17:11

a) het arduino wifi shield
b)/*
WiFi Web Server

A simple web server that shows the value of the analog input pins.
using a WiFi shield.

This example is written for a network using WPA encryption. For
WEP or WPA, change the Wifi.begin() call accordingly.

Circuit:
* WiFi shield attached
* Analog inputs attached to pins A0 through A5 (optional)

created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe

*/

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


char ssid[] = "UPC137****"; // your network SSID (name)
char pass[] = "ZJWY****"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);

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, pass);

// wait 10 seconds for connection:
delay(10000);
}
server.begin();
// you're connected now, so print out the status:
printWifiStatus();
}


void loop() {
// listen for incoming clients
WiFiClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1000);

// close the connection:
client.stop();
Serial.println("client disonnected");
}
}


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");
}
c) Alle hits op het forum op "wifi"
You tube /google/ arduino site

Als ik het shield aan de com3 poort hang krijg ik de volgende tekst in de serieële monitor:

attempting to connect to SSID: UPC137****
SSID: UPC137****
IP Adress: 192.168.0.16
Signal strength (RSSI) :-51 dBm

Als ik dit ip adres in de browserbalk typ dan krijg ik de melding dat de pagina niet beschikbaar is.

????

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Wifi shield probleem

Berichtdoor nicoverduin » 24 Aug 2014, 18:01

ff leesbaarder maken:

cpp code
/*
WiFi Web Server

A simple web server that shows the value of the analog input pins.
using a WiFi shield.

This example is written for a network using WPA encryption. For
WEP or WPA, change the Wifi.begin() call accordingly.

Circuit:
* WiFi shield attached
* Analog inputs attached to pins A0 through A5 (optional)

created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe

*/

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

char ssid[] = "UPC137****"; // your network SSID (name)
char pass[] = "ZJWY****"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);

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, pass);

// wait 10 seconds for connection:
delay(10000);
}
server.begin();
// you're connected now, so print out the status:
printWifiStatus();
}

void loop() {
// listen for incoming clients
WiFiClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6;
analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1000);

// close the connection:
client.stop();
Serial.println("client disonnected");
}
}

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");
}
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Wifi shield probleem

Berichtdoor nicoverduin » 24 Aug 2014, 18:04

En als je de server ping'ed via de dos box?
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Gebruikers-avatar
Berichten: 270
Geregistreerd: 30 Dec 2012, 11:42

Re: Wifi shield probleem

Berichtdoor Rudi » 24 Aug 2014, 20:10

nicoverduin schreef:Tom Igoe heb ik nog nooit van gehoord dus wat hij doet/laat zien ken ik niet.

Oei Nico, nou stel je me teleur. Nog nooit het IDE splash screen bekeken?
Tom Igoe is één van de Arduino co-founders.
Arduinows!
Why do computer programmers confuse Halloween with Christmas? Because Oct 31 = Dec 25
I got 01100011 problems but a bit ain't 00000001

Berichten: 8
Geregistreerd: 24 Feb 2014, 19:30

Re: Wifi shield probleem

Berichtdoor AukevanderVeen » 24 Aug 2014, 20:11

pingen gaat goed.

Direct communicatie met wifi shield.

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Wifi shield probleem

Berichtdoor nicoverduin » 25 Aug 2014, 08:12

Rudi schreef:
nicoverduin schreef:Tom Igoe heb ik nog nooit van gehoord dus wat hij doet/laat zien ken ik niet.

Oei Nico, nou stel je me teleur. Nog nooit het IDE splash screen bekeken?
Tom Igoe is één van de Arduino co-founders.
und????
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Wifi shield probleem

Berichtdoor nicoverduin » 25 Aug 2014, 08:13

AukevanderVeen schreef:pingen gaat goed.

Direct communicatie met wifi shield.
Dat betekent in ieder geval dat de shield gewoon in de lucht is en de server dus niet goed reageert.
Maar je ziet ook geen request op je serial binnenkomen. Vreemd. Dit sketchje of iets vergelijkbaars heb ik zelf ook meerdere malen gedaan en werkte prima.

@edit: met welke versie van de Arduino IDE werk je?
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 8
Geregistreerd: 24 Feb 2014, 19:30

Re: Wifi shield probleem

Berichtdoor AukevanderVeen » 25 Aug 2014, 21:59

Mij arduino versie is: Arduino 1.0.5-r2

Volgende

Terug naar Shields

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers en 3 gasten