Brauche bitte mal Eure Hilfe.
habe ein Sketch für eine Wetterstation die mit einem Ethernet Shield funktioniert.
Leider habe ich immer wieder Ärger mit meinem repeater.
Möchte nun das Shield austauschen gegen ein EPS8622 WIFI.
Diesen habe ich an Pin 10 Tx und Pin 11 Rx an dem Uno angeschlossen.
Bekomme aber einfach den Sketch nicht umgewandelt.
Kann mir da bitte jemand helfen ?
#include <Ethernet.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include "DHT.h"
//////////////////////////-- BASIC CONFIGURATION --///////////////////////////////////
#define DHTPIN 2 //PIN of the DHT sensor
#define DHTTYPE DHT22 //Type of the DHT sensor
String id = "00"; //ID of the Weatherstation (001 = own server)
String key = "BR"; //Masterkey of the weatherstation
byte mac[] = {
0xad,};
//MAC Adress of the weatherstation
const char Serverurl[] ="s1-relay";
const int windPin = 3;
const float windFactor = 2.4;
const int measureTime = 3;
volatile unsigned int windCounter = 0;
float windSpeed = 0.0;
unsigned long time = 0;
void countWind() {
windCounter ++;
}
EthernetClient client;
Adafruit_BMP085 bmp;
DHT dht(DHTPIN, DHTTYPE);
char inString[32];
int stringPos = 0;
boolean startRead = false;
void setup(){
Serial.begin(9600);
dht.begin();
Ethernet.begin(mac);
delay(1000);
if (!bmp.begin()) {
Serial.println("BMP085 error, check wiring!");
}
}
void loop(){
measureandsend();
if(millis() > 3600000){
autoreset();
}
delay(52000); //Interval (Default is every minute)
}
void measureandsend(){
windCounter = 0;
time = millis();
attachInterrupt(1,countWind,RISING);
delay(1000 * measureTime);
detachInterrupt(1);
time = (millis() - time) / 1000;
windSpeed = (float)windCounter / (float)measureTime * windFactor;
float humidity = dht.readHumidity();
String data;
data+="";
data+="text=Temp~Preasure~Humidity~Windspeed~Uptime";
data+="&submit=Submit";
Serial.print("Humidity: ");
Serial.println(humidity);
Serial.print("Wind: ");
Serial.println(windSpeed);
Serial.print("Temp: ");
Serial.println(bmp.readTemperature());
Serial.print("Pressure: ");
Serial.println(bmp.readPressure()/100);
if (client.connect(Serverurl,80)) {
Serial.println("Start transmission!");
client.println("POST /uplink.php HTTP/1.1");
client.print("Host: ");
client.println(Serverurl);
client.println("Content-Type: application/x");
client.println("Connection: close");
client.print("Content-Length: ");
client.println(data.length());
client.println();
client.print("text=");
client.print(id);
client.print(";");
client.print(key);
client.print(";");
client.print(bmp.readTemperature());
client.print(";");
client.print(bmp.readPressure()/100);
client.print(";");
client.print(humidity);
client.print(";");
client.print(windSpeed);
client.print(";");
client.print(millis()/1000);
client.print(";");
client.print("&submit=Submit");
client.println();
}
delay(5000);
if (client.connected()) {
client.stop();
Serial.println("Transmission succesful!");
}
else{
Serial.println("Transmission error!");
}
}
void autoreset(){
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
Serial.println("RESET");
}
Danke
Wollte das include Ethernet mit
#include <SoftwareSerial.h>
SoftwareSerial softSerial(10,11); // RX, TX
ersetzen