My current code that is not sending info is:
#include <SPI.h>
#include <MySensor.h>
#define CHILD_ID_WIND 1
#define WIND_SENSOR_ANALOG_PIN 1
unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds)
MySensor gw;
MyMessage msg(CHILD_ID_WIND, V_WIND);
float lastWindLevel;
void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Wind Sensor", "2.0");
// Register all sensors to gateway (they will be created as child devices)
gw.present(CHILD_ID_WIND, S_WIND);
}
void loop()
{
float windLevel = (analogRead(WIND_SENSOR_ANALOG_PIN))/31.605;
Serial.println(windLevel);
if (windLevel != lastWindLevel) {
gw.send(msg.set(windLevel, 1));
lastWindLevel = windLevel;
}
gw.sleep(SLEEP_TIME);
}
The code that is sending data (in lux) is:
#include <SPI.h>
#include <MySensor.h>
#define CHILD_ID_WIND 1
#define WIND_SENSOR_ANALOG_PIN 1
unsigned long SLEEP_TIME = 10000; // Sleep time between reads (in milliseconds)
MySensor gw;
MyMessage msg(CHILD_ID_WIND, V_LIGHT_LEVEL);
float lastWindLevel;
void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Wind Sensor", "2.0");
// Register all sensors to gateway (they will be created as child devices)
gw.present(CHILD_ID_WIND, S_LIGHT_LEVEL);
}
void loop()
{
float windLevel = (analogRead(WIND_SENSOR_ANALOG_PIN))/31.605;
Serial.println(windLevel);
if (windLevel != lastWindLevel) {
gw.send(msg.set(windLevel, 1));
lastWindLevel = windLevel;
}
gw.sleep(SLEEP_TIME);
}
I dont really see why my formula is wrong, my sensor output is 0V to 5V in wind ranging from 0m/s to 32,4ms.
This means when I have 5V on the input sensor (32,4m/s) I will measure a value of 1023 when I devide this through 31,605 I will read a value of 32,368 m/s
I have made it a float and rounded it to one decimal, so I dont realy see the problem here (please correct me if I am wrong)
I am more and more suspecting that there might be something going on on the Domoticz side.