Bonjour à tous et à toutes
Pour un TPE de première j'ai choisis de travailler sur un projet de station météo à base Arduino. Pour cela j'utilise un RHT03 et une photorésistance. Le code fonctionne très bien mais les données s'affichent sur la console série de l'ide ce qui n'est pas très utile :~
#include <DHT22.h>
#include <stdio.h>
#define DHT22_PIN 7
int photocellPin = 0;
int photocellReading;
// Setup a DHT22 instance
DHT22 myDHT22(DHT22_PIN);
void setup(void)
{
Serial.begin(9600);
}
void loop(void)
{
photocellReading = analogRead(photocellPin);
Serial.print("Analog reading = ");
Serial.print(photocellReading);
if (photocellReading < 10) {
Serial.println(" - Noir");
} else if (photocellReading < 200) {
Serial.println(" - Sombre");
} else if (photocellReading < 500) {
Serial.println(" - Lumiere");
} else if (photocellReading < 800) {
Serial.println(" - Lumineux");
} else {
Serial.println(" - Tres lumineux");
}
delay(1000);
DHT22_ERROR_t errorCode;
// The sensor can only be read from every 1-2s, and requires a minimum
// 2s warm-up after power-on.
delay(1000);
errorCode = myDHT22.readData();
switch(errorCode)
{
case DHT_ERROR_NONE:
// Alternately, with integer formatting which is clumsier but more compact to store and
// can be compared reliably for equality:
//
char buf[128];
sprintf(buf, "Temperature %hi.%01hi C, Humidity %i.%01i %% ",
myDHT22.getTemperatureCInt()/10, abs(myDHT22.getTemperatureCInt()%10),
myDHT22.getHumidityInt()/10, myDHT22.getHumidityInt()%10);
Serial.println(buf);
break;
case DHT_ERROR_CHECKSUM:
Serial.print("check sum error ");
Serial.print(myDHT22.getTemperatureC());
Serial.print("C ");
Serial.print(myDHT22.getHumidity());
Serial.println("%");
break;
case DHT_BUS_HUNG:
Serial.println("BUS Hung ");
break;
case DHT_ERROR_NOT_PRESENT:
Serial.println("Not Present ");
break;
case DHT_ERROR_ACK_TOO_LONG:
Serial.println("ACK time out ");
break;
case DHT_ERROR_SYNC_TIMEOUT:
Serial.println("Sync Timeout ");
break;
case DHT_ERROR_DATA_TIMEOUT:
Serial.println("Data Timeout ");
break;
case DHT_ERROR_TOOQUICK:
break;
}
}
Ce que je voudrais faire c'est envoyer ces données (sans fils de préférence) sur un raspberry qui héberge un site web et afficher les données sur le site. Seulement je n'ai aucune idée et google ne m'a pas aidé (à moins que j'ai mal cherché :~ ).
Je requiers donc votre aide pour me sortir de cette impasse.
Merci d'avance !
ziskezick