question stp arduino uno + module wifi shield
salut tt
j'ai une carte arduino uno rev3+ module wifi shield atmeg32uc3a1512
http://arduino.cc/en/main/arduinowifishield#.uxd8jeowa-q
et un programme telecharger
mais aucun réponse
aide moi stp
////////////////////////////////////////////////////////////////////////////////
#include <spi.h>
#include <wifi.h>
char ssid[] = "yournetwork"; // network ssid (name)
char pass[] = "secretpassword"; // network password
int keyindex = 0; // network key index number (needed wep)
int status = wl_idle_status;
wifiserver server(80);
void setup() {
//initialize serial , wait port open:
serial.begin(9600);
while (!serial) {
; // wait serial port connect. needed leonardo only
}
// check presence of shield:
if (wifi.status() == wl_no_shield) {
serial.println("wifi shield not present");
// don't continue:
while(true);
}
string fv = wifi.firmwareversion();
if( fv != "1.1.0" )
serial.println("please upgrade firmware");
// attempt connect wifi network:
while ( status != wl_connected) {
serial.print("attempting connect ssid: ");
serial.println(ssid);
// connect wpa/wpa2 network. change line if using open or wep network:
status = wifi.begin(ssid, pass);
// wait 10 seconds connection:
delay(10000);
}
server.begin();
// you're connected now, print out status:
printwifistatus();
}
void loop() {
// listen incoming clients
wificlient client = server.available();
if (client) {
serial.println("new client");
// http request ends blank line
boolean currentlineisblank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
serial.write(c);
// if you've gotten end of line (received newline
// character) , line blank, http request has ended,
// can send reply
if (c == '\n' && currentlineisblank) {
// send standard http response header
client.println("http/1.1 200 ok");
client.println("content-type: text/html");
client.println("connection: close"); // connection closed after completion of response
client.println("refresh: 5"); // refresh page automatically every 5 sec
client.println();
client.println("<!doctype html>");
client.println("<html>");
// output value of each analog input pin
(int analogchannel = 0; analogchannel < 6; analogchannel++) {
int sensorreading = analogread(analogchannel);
client.print("analog input ");
client.print(analogchannel);
client.print(" ");
client.print(sensorreading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting new line
currentlineisblank = true;
}
else if (c != '\r') {
// you've gotten character on current line
currentlineisblank = false;
}
}
}
// give web browser time receive data
delay(1);
// close connection:
client.stop();
serial.println("client disonnected");
}
}
void printwifistatus() {
// print ssid of network you're attached to:
serial.print("ssid: ");
serial.println(wifi.ssid());
// print wifi shield's ip address:
ipaddress ip = wifi.localip();
serial.print("ip address: ");
serial.println(ip);
// print received signal strength:
long rssi = wifi.rssi();
serial.print("signal strength (rssi):");
serial.print(rssi);
serial.println(" dbm");
}
///////////////////////////////////////////////////////////////////
j'ai une carte arduino uno rev3+ module wifi shield atmeg32uc3a1512
http://arduino.cc/en/main/arduinowifishield#.uxd8jeowa-q
et un programme telecharger
mais aucun réponse
aide moi stp
////////////////////////////////////////////////////////////////////////////////
#include <spi.h>
#include <wifi.h>
char ssid[] = "yournetwork"; // network ssid (name)
char pass[] = "secretpassword"; // network password
int keyindex = 0; // network key index number (needed wep)
int status = wl_idle_status;
wifiserver server(80);
void setup() {
//initialize serial , wait port open:
serial.begin(9600);
while (!serial) {
; // wait serial port connect. needed leonardo only
}
// check presence of shield:
if (wifi.status() == wl_no_shield) {
serial.println("wifi shield not present");
// don't continue:
while(true);
}
string fv = wifi.firmwareversion();
if( fv != "1.1.0" )
serial.println("please upgrade firmware");
// attempt connect wifi network:
while ( status != wl_connected) {
serial.print("attempting connect ssid: ");
serial.println(ssid);
// connect wpa/wpa2 network. change line if using open or wep network:
status = wifi.begin(ssid, pass);
// wait 10 seconds connection:
delay(10000);
}
server.begin();
// you're connected now, print out status:
printwifistatus();
}
void loop() {
// listen incoming clients
wificlient client = server.available();
if (client) {
serial.println("new client");
// http request ends blank line
boolean currentlineisblank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
serial.write(c);
// if you've gotten end of line (received newline
// character) , line blank, http request has ended,
// can send reply
if (c == '\n' && currentlineisblank) {
// send standard http response header
client.println("http/1.1 200 ok");
client.println("content-type: text/html");
client.println("connection: close"); // connection closed after completion of response
client.println("refresh: 5"); // refresh page automatically every 5 sec
client.println();
client.println("<!doctype html>");
client.println("<html>");
// output value of each analog input pin
(int analogchannel = 0; analogchannel < 6; analogchannel++) {
int sensorreading = analogread(analogchannel);
client.print("analog input ");
client.print(analogchannel);
client.print(" ");
client.print(sensorreading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting new line
currentlineisblank = true;
}
else if (c != '\r') {
// you've gotten character on current line
currentlineisblank = false;
}
}
}
// give web browser time receive data
delay(1);
// close connection:
client.stop();
serial.println("client disonnected");
}
}
void printwifistatus() {
// print ssid of network you're attached to:
serial.print("ssid: ");
serial.println(wifi.ssid());
// print wifi shield's ip address:
ipaddress ip = wifi.localip();
serial.print("ip address: ");
serial.println(ip);
// print received signal strength:
long rssi = wifi.rssi();
serial.print("signal strength (rssi):");
serial.print(rssi);
serial.println(" dbm");
}
///////////////////////////////////////////////////////////////////
programme téléchargé et aucune réponse ... si la mienne !
Arduino Forum > International > Français (Moderators: jfs, Snootlab) > question stp arduino uno + module wifi shield
arduino
Comments
Post a Comment