TWIG Temp&Humi Sensor sketch sample does not work

Hello, can you tell me why the sample sketch does not work ? thank you for your response.

#define DHT11_PIN 0 // ADC0
byte read_dht11_dat()
{
byte i = 0;
byte result=0;
for(i=0; i< 8; i++){
while(!(PINC & _BV(DHT11_PIN))); // wait for 50us
delayMicroseconds(30);

if(PINC &amp; _BV(DHT11_PIN)) 
  result |=(1&lt;&lt;(7-i));
while((PINC &amp; _BV(DHT11_PIN)));  // wait '1' finish

}
return result;
}
void setup()
{
DDRC |= _BV(DHT11_PIN);
PORTC |= _BV(DHT11_PIN);

Serial.begin(9600);

Serial.println(“Ready”);
}

void loop()
{
byte dht11_dat[5];
byte dht11_in;
byte i;
// start condition
// 1. pull-down i/o pin from 18ms
PORTC &= ~_BV(DHT11_PIN);
delay(18);
PORTC |= _BV(DHT11_PIN);
delayMicroseconds(40);

DDRC &= ~_BV(DHT11_PIN);
delayMicroseconds(40);

dht11_in = PINC & _BV(DHT11_PIN);

if(dht11_in){
Serial.println(“dht11 start condition 1 not met”);
return;
}
delayMicroseconds(80);

dht11_in = PINC & _BV(DHT11_PIN);

if(!dht11_in){
Serial.println(“dht11 start condition 2 not met”);
return;
}
delayMicroseconds(80);
// now ready for data reception
for (i=0; i<5; i++)
dht11_dat[i] = read_dht11_dat();

DDRC |= _BV(DHT11_PIN);
PORTC |= _BV(DHT11_PIN);

byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3];
// check check_sum
if(dht11_dat[4]!= dht11_check_sum)
{
Serial.println(“DHT11 checksum error”);
}

Serial.print(“Current humdity = “);
Serial.print(dht11_dat[0], DEC);
Serial.print(”.”);
Serial.print(dht11_dat[1], DEC);
Serial.print("% ");
Serial.print(“temperature = “);
Serial.print(dht11_dat[2], DEC);
Serial.print(”.”);
Serial.print(dht11_dat[3], DEC);//the decimal part will be always 0, as it dose not support that precision yet
Serial.println("C ");

delay(2000);
}


sketch_may03c.cpp: In function ‘byte read_dht11_dat()’:
sketch_may03c:5: error: ‘lt’ was not declared in this scope
sketch_may03c:5: error: expected )' before ';' token sketch_may03c:5: error: expected ;’ before ‘)’ token
sketch_may03c.cpp: In function ‘void loop()’:
sketch_may03c:32: error: ‘amp’ was not declared in this scope
sketch_may03c:32: error: expected primary-expression before ‘=’ token
sketch_may03c:37: error: expected primary-expression before ‘=’ token
sketch_may03c:56: error: ‘lt’ was not declared in this scope
sketch_may03c:56: error: expected )' before ';' token sketch_may03c:56: error: expected ;’ before ‘)’ token

Pay attention to your code. As you can see there are some codes different than usual arduino language. For example < stands for “less than”, the tradicional math operator ‘<’ and & stands for ‘&’.

This happened due to codification errors between different languages

Replace these instances with the correct ones, should work fine.

Thanks it’s now working…