{"action":"closed","issue":{"url":"https://api.github.com/repos/beegee-tokyo/DHTespOrg/issues/4","repository_url":"https://api.github.com/repos/beegee-tokyo/DHTespOrg","labels_url":"https://api.github.com/repos/beegee-tokyo/DHTespOrg/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/beegee-tokyo/DHTespOrg/issues/4/comments","events_url":"https://api.github.com/repos/beegee-tokyo/DHTespOrg/issues/4/events","html_url":"https://github.com/beegee-tokyo/DHTespOrg/issues/4","id":341728356,"node_id":"MDU6SXNzdWUzNDE3MjgzNTY=","number":4,"title":"Cant seem to get it working with Ticker","user":{"login":"vangalvin","id":11986968,"node_id":"MDQ6VXNlcjExOTg2OTY4","avatar_url":"https://avatars1.githubusercontent.com/u/11986968?v=4","gravatar_id":"","url":"https://api.github.com/users/vangalvin","html_url":"https://github.com/vangalvin","followers_url":"https://api.github.com/users/vangalvin/followers","following_url":"https://api.github.com/users/vangalvin/following{/other_user}","gists_url":"https://api.github.com/users/vangalvin/gists{/gist_id}","starred_url":"https://api.github.com/users/vangalvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vangalvin/subscriptions","organizations_url":"https://api.github.com/users/vangalvin/orgs","repos_url":"https://api.github.com/users/vangalvin/repos","events_url":"https://api.github.com/users/vangalvin/events{/privacy}","received_events_url":"https://api.github.com/users/vangalvin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-17T00:58:20Z","updated_at":"2018-07-17T01:56:03Z","closed_at":"2018-07-17T01:56:03Z","author_association":"NONE","body":"I have been building a small heating system that uses a fan and heater driven by a couple of PID routines, monitors the temperature and ideally I wanted to add a humidity sensor. In the system I make use of the Ticker library for updating the temperatures etc.\r\n\r\nIt seems that using this library in the loop works perfectly but a soon as you try to use it via a ticker the sensor reports nan.. \r\n\r\n`#include <Ticker.h>\r\n#include \"DHTesp.h\"\r\n\r\nTicker DHTSensor;\r\n\r\n#define DHT_PIN D1\r\nbool loopread = true;\r\n\r\nDHTesp dht;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  analogWriteFreq(10000); //Set the PWM to 10000 to stop the fan noise.\r\n  dht.setup(DHT_PIN, DHTesp::DHT11); // Connect DHT sensor\r\n  if(!loopread){\r\n      Serial.println(\"Starting Humiditiy Sensor\");\r\n      DHTSensor.attach(2, getDHTData);  //2 second interval to read the sensor\r\n  }\r\n}\r\n\r\nvoid loop() {\r\nif(loopread){\r\n  delay(2000);\r\n  float humidity = dht.getHumidity();\r\n  float temperature = dht.getTemperature();\r\n  Serial.print(dht.getStatusString());\r\n  Serial.print(\"\\t\");\r\n  Serial.print(humidity, 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.print(temperature, 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.print(dht.toFahrenheit(temperature), 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.print(dht.computeHeatIndex(temperature, humidity, false), 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.println(dht.computeHeatIndex(dht.toFahrenheit(temperature), humidity, true), 1);\r\n}\r\n}\r\n\r\nvoid getDHTData(){\r\n//  delay(2000);\r\n  float humidity = dht.getHumidity();\r\n  float temperature = dht.getTemperature();\r\n  Serial.print(dht.getStatusString());\r\n  Serial.print(\"\\t\");\r\n  Serial.print(humidity, 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.print(temperature, 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.print(dht.toFahrenheit(temperature), 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.print(dht.computeHeatIndex(temperature, humidity, false), 1);\r\n  Serial.print(\"\\t\\t\");\r\n  Serial.println(dht.computeHeatIndex(dht.toFahrenheit(temperature), humidity, true), 1);\r\n}`"}}
{"actor":{"display_login":"vangalvin"}}