hi i found this code for the classic over serial print with usb for my sensor SHT11(the same SHT15).
//Read temperature and humidity values from an SHT1x-series (SHT10,
//SHT11, SHT15) sensor.
#include <SHT1x.h>
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);
void setup()
{
Serial.begin(38400); // Open serial connection to report values to host
Serial.println("Starting up");
}
void loop()
{
float temp_c;
float temp_f;
float humidity;
// Read values from the sensor
temp_c = sht1x.readTemperatureC();
temp_f = sht1x.readTemperatureF();
humidity = sht1x.readHumidity();
// Print the values to the serial port
Serial.print("Temperature: ");
Serial.print(temp_c, DEC);
Serial.print("C / ");
Serial.print(temp_f, DEC);
Serial.print("F. Humidity: ");
Serial.print(humidity);
Serial.println("%");
delay(2000);
}
and i do this wifi with this code but it doesn't work. why?????????
#include <WiServer.h>
#include <string.h>
#include <SHT1x.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
//#define watpin 12
#define dataPin 10
#define clockPin 11
#define funPin 5
//Wireless configuration parameters
unsigned char local_ip[] = { 192,168,1,5}; // IP address of WiShield
unsigned char gateway_ip[] = { 192,168,1,254}; // router or gateway IP address
unsigned char subnet_mask[] = { 255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = { "all"}; // max 32 bytes
unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
const prog_char security_passphrase[] PROGMEM = { "12345678"}; // max 64 characters
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
};
unsigned char wireless_mode = WIRELESS_MODE_ADHOC;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters
SHT1x sht1x(dataPin, clockPin);
int tempC;
int humidity;
boolean sendMyPage(char* URL) {
if (strcmp(URL, "/") == 0) {
// Use print and println functions to write out the page
WiServer.print("<html>");
WiServer.print("<body><p><div align=center><b>TEMP :<hr /></b></p></body>");
WiServer.print("</html>");
WiServer.print(tempC, DEC);
WiServer.println("</value> %</data>");
WiServer.print("<data id=\"5\">\n<value>");
return true;
}
// URL not found
return false;
}
void setup()
{
Serial.begin(9600);
WiServer.init(sendMyPage);
}
void loop()
{
WiServer.server_task();
tempC = sht1x.readTemperatureC();
humidity = sht1x.readHumidity();
delay(10);
}