1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Changes to integrate latest core updates to WiFly branch

This commit is contained in:
mlafauci
2011-08-31 10:34:51 +02:00
parent 9785b99cba
commit 00b945d869
23 changed files with 136 additions and 251 deletions

View File

@ -22,16 +22,16 @@
*/
#include <WiFi.h>
#include <IPAddress.h>
char ssid[32] = { 0 };
char ssid[] = "yourNetwork";
char pass[] = "secretPassword";
int status = WL_IDLE_STATUS;
// The address of the server you want to connect to (pachube.com):
IPAddress server(173,203,98,29);
// initialize the library instance:
Client client(server, 80);
WiFiClient client;
long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop
@ -40,11 +40,10 @@ const int postingInterval = 10000; //delay between updates to Pachube.com
int startWiFiWpa()
{
Serial.println("\nSetup WiFi Wpa...");
//strcpy(ssid, "AndroidAP9647");
strcpy(ssid, "Cariddi");
strcpy(ssid, "tigoenet");
Serial.print("SSID: ");
Serial.println(ssid);
const char *pass = "1234567890";
const char *pass = "m30w-m30w";
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED)
{
@ -110,11 +109,11 @@ void loop() {
// this method makes a HTTP connection to the server:
void sendData(String thisData) {
// if there's a successful connection:
if (client.connect()) {
if (client.connect(server, 80)) {
Serial.println("connecting...");
// send the HTTP PUT request.
// fill in your feed address here:
client.print("PUT /api/http://api.pachube.com/v2/feeds/24196.csv HTTP/1.1\n");
client.print("PUT /api/24196.csv HTTP/1.1\n");
client.print("Host: www.pachube.com\n");
// fill in your Pachube API key here:
client.print("X-PachubeApiKey: gw0L2A-J5ACRGQccX59tCYt0IEzyecr-SoiuC47U1-8\n");

View File

@ -7,7 +7,7 @@
* WiFi shield attached
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
modified 5 June 2011
by Tom Igoe
*/

View File

@ -7,7 +7,7 @@
* WiFi shield attached
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
modified 5 June 2011
by Tom Igoe
*/
@ -61,7 +61,7 @@ void loop() {
void printIpData() {
// print your WiFi shield's IP address:
ip = WiFi.localIp();
ip = WiFi.localIP();
Serial.print("IP: ");
Serial.print(ip[3]);
Serial.print(".");

View File

@ -25,7 +25,7 @@ char pass[] = "secretPassword"; // the WPA2 password for your network
int status = WL_IDLE_STATUS; // the Wifi radio's status
// telnet defaults to port 23
Server server(23);
WiFiServer server(23);
boolean gotAMessage = false; // whether or not you got a message from the client yet
@ -56,7 +56,7 @@ void setup() {
void loop() {
// wait for a new client:
Client client = server.available();
WiFiClient client = server.available();
// when the client sends the first byte, say hello:
if (client) {

View File

@ -31,7 +31,7 @@ int status = WL_IDLE_STATUS;
IPAddress server(173,203,98,29);
// initialize the library instance:
Client client;
WiFiClient client;
long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop

View File

@ -7,7 +7,7 @@
* WiFi shield attached
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
modified 5 June 2011
by Tom Igoe
*/
@ -16,9 +16,8 @@
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "yourNetwork"; // the name of your network
char pass[] = "secretPassword"; // the WPA2 password for your network
char ssid[] = "yourNetwork";
char pass[] = "secretpassword";
int status = WL_IDLE_STATUS; // the Wifi radio's status
byte mac[6]; // the MAC address of your Wifi shield
@ -29,7 +28,11 @@ IPAddress subnet; // the subnet mask
void setup() {
// initialize serial:
Serial.begin(9600);
// scan for existing networks:
Serial.println("Scanning available networks...");
//WiFi.begin();
scanNetworks();
// attempt to connect using WEP encryption:
// Serial.println("Attempting to connect to WEP-128 network...");
// status = WiFi.begin(ssid, keyIndex, key);

View File

@ -24,7 +24,7 @@ char pass[] = "secretpassword";
int status = WL_IDLE_STATUS;
// initialize the library instance:
Client client;
WiFiClient client;
const int requestInterval = 30*1000; // delay between requests; 30 seconds

View File

@ -9,7 +9,7 @@
* WiFi shield attached
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
modified 21 May 2011
by Tom Igoe
*/
@ -17,7 +17,6 @@
#include <SPI.h>
#include <WiFi.h>
#include <IPAddress.h>
char ssid[] = "yourNetwork";
char pass[] = "secretPassword";
@ -27,7 +26,7 @@ IPAddress server(74,125,115,105); // Google
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
Client client;
WiFiClient client;
void setup() {
Serial.begin(9600);

View File

@ -9,7 +9,7 @@
* Analog inputs attached to pins A0 through A5 (optional)
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
modified 5 June 2011
by Tom Igoe
*/
@ -22,7 +22,7 @@ char ssid[] = "yourNetwork";
char pass[] = "secretpassword";
int status = WL_IDLE_STATUS;
Server server(80);
WiFiServer server(80);
void setup() {
// initialize serial:
@ -39,7 +39,7 @@ void setup() {
else {
server.begin();
Serial.print("Connected to wifi. My address:");
IPAddress myAddress = WiFi.localIp();
IPAddress myAddress = WiFi.localIP();
Serial.print(myAddress[0]);
Serial.print(".");
Serial.print(myAddress[1]);
@ -53,7 +53,7 @@ void setup() {
void loop() {
// listen for incoming clients
Client client = server.available();
WiFiClient client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;

View File

@ -6,10 +6,9 @@
A simple server is setup to exchange data.
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
*/
#include <WiFi.h>
#include <IPAddress.h>
byte mac[6] = { 0 };
IPAddress ip;
@ -19,11 +18,11 @@ byte dataBuf[80] = { 0 };
char ssid[32] = { 0 };
int status = WL_IDLE_STATUS;
Server server(23);
WiFiServer server(23);
void printIpData()
{
ip = WiFi.localIp();
ip = WiFi.localIP();
Serial.print("IP: ");
Serial.print(ip[3],10);Serial.print(".");
@ -136,7 +135,7 @@ void loop()
if (status == WL_CONNECTED)
{
byte status = 0;
Client client = server.available(&status);
WiFiClient client = server.available(&status);
if (client) {
//Serial.print("Status: ");
//Serial.println(status, 16);

View File

@ -6,10 +6,9 @@
A simple server is setup to exchange data.
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
*/
#include <WiFi.h>
#include <IPAddress.h>
byte mac[6] = { 0 };
IPAddress ip;
@ -21,12 +20,11 @@ int status = WL_IDLE_STATUS;
#define MAX_NUM_SSID 10
char ssidList[MAX_NUM_SSID][32] = { {0} };
Server server(23);
WiFiServer server(23);
void printIpData()
{
ip = WiFi.localIp();
ip = WiFi.localIP();
Serial.print("IP: ");
Serial.print(ip[3],10);Serial.print(".");
@ -147,7 +145,7 @@ void loop()
if (status == WL_CONNECTED)
{
byte _status = 0;
Client client = server.available(&_status);
WiFiClient client = server.available(&_status);
if (client) {
Serial.print("Status: ");
Serial.println(status, 16);

View File

@ -6,10 +6,10 @@
A simple server is setup to exchange data.
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
*/
#include <WiFi.h>
#include <IPAddress.h>
#define _PRINT_
byte mac[6] = { 0 };
@ -23,12 +23,12 @@ int status = WL_IDLE_STATUS;
char ssidList[MAX_NUM_SSID][32] = { {0} };
Server server(23);
WiFiServer server(23);
boolean gotAMessage = false; // whether or not you got a message from the client yet
void printIpData()
{
ip = WiFi.localIp();
ip = WiFi.localIP();
Serial.print("\nIP: ");
Serial.print(ip[3],10);Serial.print(".");
@ -153,8 +153,7 @@ void execCmd(char* buf)
Serial.print("\nExecuting command: ");
Serial.println(buf);
#endif
//server.write(buf);
server.print(buf);
server.write(buf);
}
@ -163,7 +162,7 @@ void loop()
if (status == WL_CONNECTED)
{
byte _status = 0;
Client client = server.available(&_status);
WiFiClient client = server.available(&_status);
if (client) {
if (!gotAMessage) {
Serial.println("\nWe have a new client\n");

View File

@ -6,10 +6,9 @@
A simple server is setup to exchange data.
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
*/
#include <WiFi.h>
#include <IPAddress.h>
byte mac[6] = { 0 };
IPAddress ip;
@ -22,11 +21,11 @@ int status = WL_IDLE_STATUS;
char ssidList[MAX_NUM_SSID][32] = { {0} };
Server server(23);
WiFiServer server(23);
void printIpData()
{
ip = WiFi.localIp();
ip = WiFi.localIP();
Serial.print("IP: ");
Serial.print(ip[3],10);Serial.print(".");

View File

@ -6,10 +6,9 @@
A simple server is setup to exchange data.
created 13 July 2010
by Domenico La Fauci
by dlf (Metodo2 srl)
*/
#include <WiFi.h>
#include <IPAddress.h>
byte mac[6] = { 0 };
IPAddress ip;
@ -22,11 +21,11 @@ int status = WL_IDLE_STATUS;
char ssidList[MAX_NUM_SSID][32] = { {0} };
Server server(23);
WiFiServer server(23);
void printIpData()
{
ip = WiFi.localIp();
ip = WiFi.localIP();
Serial.print("IP: ");
Serial.print(ip[3],10);Serial.print(".");