help with writhing a code for smart room

hello everyone!
so i got an arduino! less then 3 hours later i fried it :-[
but when it still worked i had few problems
i watched a lot of tutorials on youtube and i was thinking that it will be easy!
i was wrong.
i got the dht11 temp sensore and download the libary, it worked. but i couldent write something thet will turn a led in certain tempature… this is the code and ill be very happy if you show me how to do this:

Board int.0 int.1 int.2 int.3 int.4 int.5
Uno, Ethernet 2 3
Mega2560 2 3 21 20 19 18
Leonardo 3 2 0 1
Due (any pin, more info

#include <idDHT11.h>

int idDHT11pin = 2; //Digital pin for comunications
int idDHT11intNumber = 0; //interrupt number (must be the one that use the previus defined pin (see table above)

void dht11_wrapper(); // must be declared before the lib initialization

// Lib instantiate
idDHT11 DHT11(idDHT11pin,idDHT11intNumber,dht11_wrapper);

void setup()
Serial.println(“idDHT11 Example program”);
Serial.print(“LIB version: “);
// This wrapper is in charge of calling
// mus be defined like this for the lib work
void dht11_wrapper() {
void loop()
Serial.print("\nRetrieving information from sensor: ");
Serial.print("Read sensor: ");
while (DHT11.acquiring())
int result = DHT11.getStatus();
switch (result)
Serial.println(“Error\n\r\tChecksum error”);
Serial.println(“Error\n\r\tISR Time out error”);
Serial.println(“Error\n\r\tResponse time out error”);
Serial.println(“Error\n\r\tData time out error”);
Serial.println(“Error\n\r\tDelta time to small”);
Serial.println(“Error\n\r\tNot started”);
Serial.println(“Unknown error”);
Serial.print("Humidity (%): ");
Serial.println(DHT11.getHumidity(), 2);

Serial.print("Temperature (oC): ");
Serial.println(DHT11.getCelsius(), 2);


and for the other subject… i want to turn a led strip with clap and photoresistor sensors…
im going to use a mosfet resistor so ill be able to dim the lights( BTW i fried the arduino while trying to turn led strip with the arduino and the mosfet but now i know how to do it :sweat_smile: ).
the code i need sounds so sipmle! but i cant write it by myself :sob:
ill try to tell you what i want and maybe you could help me.

this is the clap sensor:
turn a led on if the arduino detects 2 claps. (im sure i can find this online but i dont know hoe to combine is with the rest of the things i want)

the in/out of the room sensor:(there is gonna be 2 photoresistors that a laser beam is going to hit tham + a pressure sensor so the arduino will know if someone is sleeping in the room)

when laser beam “1” breaks and then laser beam"2" breaks turn led on unless pressure sensor is activated.

when laser beam “2” breakes and then laser beam “1” breaks turn led off.

im very sorry for the lond topic but i know you the best in the arduino and in my cuntry i cant get any help with it (its my way to say sorry for my english :smiley: )

thank al lot!

Your Arduino with not be the only thing writhing after this. Use "code" tags, not "quote" tags.

Killing your Arduino has nothing to do with wrong code, only ham-fistedness.

Rather than ask for help with long and complex code that you don't understand yourself, start by working through several of the examples that come with the Arduino IDE. When you understand how they work and are confident that you can write your own short programs it will be time to start on bigger and more complex projects.

The most likely reason for frying an Arduino is connecting the external wiring incorrectly - perhaps using an LED without a current limiting resistor or wiring a switch so that it causes a short circuit. The Arduino I/O pins can only receive or supply about 20 milliamps and you can't take 20 mA from all of them at the same time. Also they can only deal with voltages between 0 and 5 volts. The details are in the Atmel Atmega 328 datasheet.


I'm new too so being very careful about what I can attach to the board and what I cant. Not good to fry the board so soon.

I've found that maybe what you are looking for on YouTube there is a chap called Jeremy Blum who has done some great tutorials for what you may need.

Build the curcuit gradually, try getting the raw data output to the screen so that you can see how it hits the Arduino before you try and make it for specific levels.

On a couple of tutorials he goes through sensors for temperature, light and distance to pickup motion.
For someone new they are worth while, I'm in the process of running through some of his examples and I tyoe the code myself rather than copy and paste as you make mistakes that are shown when you compile it and learn how to resolve them pretty quickly.