I'm confused

Hello,
I'm a C++ newbie, I've done some small guided Arduino projects in the past and I decided to step up my game a bit, I'm working on a temperature controlled box. The set up is simple, two 5v relays and a RHT03 temperature and humidity sensor. Problem is the data sheet is pretty much useless and the example is leaving me a bit stumped.
Here's the example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  byte i = 0;
  byte result=0;
  for(i=0; i< 8; i++){
  //We enter this during the first start bit (low for 50uS) of the byte
  while(!(PINC & _BV(DHT11_PIN)));  // wait until pin goes high
           //signalling end of start of bit's transmission.
  //Dataline will stay high for 27 or 70 uS, depending on if
  //   a 0 or a 1 is being sent, respectively
  delayMicroseconds(30);//AFTER pin is high, wait further period, to be
      //into the part of the timing diagram where a 0 or a 1 denotes
      //the datum being send. The "further period" was 30uS in the software
      //that this has been created from. I believe that a higher number
      //(45?) would be more appropriate.

  if(PINC & _BV(DHT11_PIN))//If pin still high
	result |=(1<<(7-i));// "add" (not just addition) the 1 to the
                //growing byte
  while((PINC & _BV(DHT11_PIN)));  // wait for pin to go low again, which
          //signals he START of the NEXT bit's transmission.
  }//end of "for.."
  return result;
}//end of "read_dht11_dat()"


void setup()
{
	DDRC |= _BV(DHT11_PIN);//set data pin... for now... as out(?)put
              //DDRC is data direction register for pins A0-5 are on
	PORTC |= _BV(DHT11_PIN);//(dis?)-connect internal pull up on line
              //PORTC relates to the pins A0-5 are on.
Serial.begin(9600);
delay(300);//Let system settle
Serial.println("Humidity and temperature\n\n");
delay(700);//Wait rest of 1000ms recommended delay before
  //accessing sensor.
	}

void loop()
{
	byte dht11_dat[5];//Array to hold the bytes sent from sensor. 0-4 should be enough
           //don't belive dht11_dat[5] is used.
	byte dht11_in;
	byte i;
	// Send "start read and report" command to sensor....
	// 1. pull-down i/o pin for 18ms
	PORTC &= ~_BV(DHT11_PIN);
}

Can someone please break this down in dummy friendly therms?
Last edited on
Ah crap I completely forgot about that reference page, thanks for the link.
Topic archived. No new replies allowed.