Author Topic: DigiSpark + Temperature Sensor  (Read 3500 times)

NoG

  • Newbie
  • *
  • Posts: 1
DigiSpark + Temperature Sensor
« on: October 18, 2019, 12:22:04 pm »
Dear coders,
I was just trying to connect and test some modules (sensors) on the Digispark. I was also testing DHT11 temperature sensor. I have coded just really simple code for it. I have used DigisparkKeyboard feature, since Digispark does not support Serial Monitor. However it seems like, I have also done some mistakes in my code. I'm sure, that my circuit connection is OK. Can I ask, why I do not get any output?
Thank you for all the answers.

Code:
Code: [Select]
#define period 5

#include <DHT.h>
#include <DigiKeyboard.h>
DHT dht(4, DHT11);

void setup() {
  dht.begin();
  DigiKeyboard.sendKeyStroke(0);
}

void loop() {
  float t = dht.readTemperature();
  float h = dht.readHumidity();

  DigiKeyboard.println(t);
  delay(period*1000);
}
« Last Edit: October 18, 2019, 12:31:03 pm by NoG »