<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — simple code for DHT sensor shows wrong values on dashboard]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1865&amp;type=atom" />
	<updated>2024-11-15T08:35:45Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1865</id>
		<entry>
			<title type="html"><![CDATA[Re: simple code for DHT sensor shows wrong values on dashboard]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5759#p5759" />
			<content type="html"><![CDATA[<p>solved!<br />Thanks both of you for the fast feedback.<br />Cant believe that I missed that thingy in the structure, &quot;lost&quot; alot of time^^.<br />BR; Mirza</p>]]></content>
			<author>
				<name><![CDATA[zr1m]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2917</uri>
			</author>
			<updated>2024-11-15T08:35:45Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5759#p5759</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: simple code for DHT sensor shows wrong values on dashboard]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5756#p5756" />
			<content type="html"><![CDATA[<p>Your RemoteXY structure is incorrect. Please copy it from the editor as is.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2024-11-15T08:20:54Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5756#p5756</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: simple code for DHT sensor shows wrong values on dashboard]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5754#p5754" />
			<content type="html"><![CDATA[<p>Hi Zr1m</p><p>Could you show what value you would get in the app compared to the serial monitor?</p><p>Regards</p><p>LF</p>]]></content>
			<author>
				<name><![CDATA[Leapfrog]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2916</uri>
			</author>
			<updated>2024-11-15T00:53:13Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5754#p5754</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[simple code for DHT sensor shows wrong values on dashboard]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5751#p5751" />
			<content type="html"><![CDATA[<p>Hi All,</p><p>I&#039;am newbie and my simple code doesnt show nearly right values of the DHT Sensor in the mobile app. The Serial Monitor is correct.<br /></p><div class="codebox"><pre><code>#include &lt;Wire.h&gt;
#include &quot;HT_SSD1306Wire.h&quot; // OLED Display
#include &lt;WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;DHT.h&gt; // Bibliothek für DHT-Sensor

#define DHTPIN 14 // Pin für DHT11 Sensor
#define DHTTYPE DHT11 // Sensortyp ist DHT11
#define PIN_RELEAISSWITCHLIGHT230V 17 // Pin für das Relais

// RemoteXY Konfiguration
#define REMOTEXY_MODE__WIFI_CLOUD

// RemoteXY connection settings 
#define REMOTEXY_WIFI_SSID &quot;&quot;
#define REMOTEXY_WIFI_PASSWORD &quot;&quot;
#define REMOTEXY_CLOUD_SERVER &quot;cloud.remotexy.com&quot;
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN &quot;&quot;

#include &lt;RemoteXY.h&gt;

#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 112 bytes
  { 255,1,0,12,0,105,0,19,0,0,0,0,31,1,106,200,1,1,5,0,
  2,4,11,50,7,0,2,26,31,31,79,78,0,79,70,70,0,129,3,4,
  67,6,64,17,82,101,108,97,105,115,95,77,97,105,110,76,105,103,104,116,
  50,51,48,86,0,68,6,72,95,43,49,8,36,86,97,114,105,97,98,108,
  101,32,49,0,68,5,121,95,43,49,8,13,86,97,114,105,97,98,108,101,
  32,49,0,67,4,35,40,10,78,2,26,2 };

struct {
  uint8_t releaisSwitchLight230V; // =1 if switch ON and =0 if OFF
  uint8_t connect_flag; // =1 if wire connected, else =0
  float humidityGraph2;   // actually a value widget for test purpose
  float temperatureGraph; // graph widget
  float humidityGraph; // graph widget
} RemoteXY;
#pragma pack(pop)

DHT dht(DHTPIN, DHTTYPE); // DHT-Sensor-Objekt erstellen

// OLED Display-Konfiguration
#ifdef WIRELESS_STICK_V3
static SSD1306Wire display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_64_32, RST_OLED);
#else
static SSD1306Wire display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_128_64, RST_OLED);
#endif

void setup() {
  Serial.begin(115200);
  RemoteXY_Init();
  
  pinMode(PIN_RELEAISSWITCHLIGHT230V, OUTPUT);
  digitalWrite(PIN_RELEAISSWITCHLIGHT230V, LOW); // Relais initial aus
  
  display.init();
  display.flipScreenVertically();
  display.setFont(ArialMT_Plain_10);
  display.clear();
  display.drawString(0, 0, &quot;Waiting for RemoteXY...&quot;);
  display.display();

  dht.begin(); // DHT-Sensor initialisieren
}

void loop() {
  RemoteXY_Handler();

  // Relaissteuerung
  digitalWrite(PIN_RELEAISSWITCHLIGHT230V, RemoteXY.releaisSwitchLight230V == 1 ? HIGH : LOW);
  
  // Sensordaten lesen und anzeigen
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  if (!isnan(temperature) &amp;&amp; !isnan(humidity)) {
    // Daten auf dem Display anzeigen
    display.clear();
    display.drawString(0, 0, &quot;Temp: &quot; + String(temperature) + &quot; C&quot;);
    display.drawString(0, 12, &quot;Humidity: &quot; + String(humidity) + &quot; %&quot;);
    display.display();

    // Debug-Ausgabe auf der seriellen Konsole
    Serial.print(&quot;Temperatur: &quot;);
    Serial.print(temperature);
    Serial.print(&quot; C, Luftfeuchtigkeit: &quot;);
    Serial.print(humidity);
    Serial.println(&quot; %&quot;);

    

    // Die Sensorwerte direkt als float übertragen
    RemoteXY.humidityGraph = humidity;
    RemoteXY.temperatureGraph = temperature;
    RemoteXY.humidityGraph2 = humidity;

    RemoteXY_delay(1000);

  } else {
    Serial.println(&quot;Fehler beim Lesen des DHT11-Sensors!&quot;);
    
  }
}</code></pre></div><p>what I&#039;m doint wrong here? </p><p>BR; zr1m</p>]]></content>
			<author>
				<name><![CDATA[zr1m]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2917</uri>
			</author>
			<updated>2024-11-14T14:34:48Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5751#p5751</id>
		</entry>
</feed>
