guarda, considerando la possibile implementazione di altre funzioni passo all'arduino mega e taglio la testa al toro... e quello che ho lo utilizzo per progettini nel tempo libero.
preferisco tenere come valida la scheda wifi che ho postato primo perché posso averla in giornata andandola a prendere, secondo perché, nonostante non funzionino sul mio attuale IDE che è il 22, almeno ha già la libreria pronta da scaricare comprensiva di esempi..
vorrei riformulare, a questo punto, la domanda...
questo è lo sketch d'esempio che mi ritrovo:
/*
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,2}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"ASYNCLABS"}; // max 32 bytes
unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};
// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------
// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
// Check if the requested URL matches "/"
if (strcmp(URL, "/") == 0) {
// Use WiServer's print and println functions to write out the page content
WiServer.print("<html>");
WiServer.print("Hello World!");
WiServer.print("</html>");
// URL was recognized
return true;
}
// URL not found
return false;
}
void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
}
void loop(){
// Run WiServer
WiServer.server_task();
delay(10);
}
e la mia domanda è:
i valori che vorrei ritrovarmi sulla pagina internet, li posso inserire direttamente in questestringhe di codice?:
WiServer.print("");
WiServer.print("Hello World!"); //QUESTA IN PARTICOLARE//
WiServer.print("");
e quindi, riprendendoli dallo sketch del mio arduino, mi basterebbe inserire questi parametri?:
lcd.print(sensors.getTempCByIndex(2)); --> diventerebbe --> WiServer.print(sensors.getTempCByIndex(2))
lcd.print(sensors.getTempCByIndex(1)); --> WiServer.print(sensors.getTempCByIndex(1))
lcd.print((sensors.getTempCByIndex(0)); --> WiServer.print((sensors.getTempCByIndex(0))
Spero di non scrivere cavolate, sto cercando di capire se la scrittura di dati su pagina web è simile nelle istruzioni a quella che si usa per impartire comandi ai display come il mio..
riassumendo in soldoni:
Se nel mio programma Arduino legge e riporta sul display 3 temperature in I2C sul pin 10 e volessi fargliele anche riportare sulla web page che lui mi crea apposta mi basterebbe implementare nel mio codice finito quello relativo alla wifi shield ed aggiungere i parametri che deve mandare online?
dovrebbe venire una cosa così:
WiServer.print("");
WiServer.print("Temperature");
WiServer.print(sensors.getTempCByIndex(2))
WiServer.print(sensors.getTempCByIndex(1))
WiServer.print(sensors.getTempCByIndex(0))
WiServer.print("");
ottenendo così un risultato del genere aprendo la pagina web:
Temperature
24.05
26.59
40.23
?
scusate l'elementarità della domanda... ad avere arduino mega e la shield avrei provato direttamente io...