user40455: I am creating a project in which an Arduino reads (gets) a value from
a DHT sensor. The DHT sensor returns two values:

Temperature
Humidity 


My assembly code:
sbi ddrd,5
cbi ddrd,2
sbi portd,5

start:

in r16,Pind2
cpi r16,80
brne On

jmp start

On:
cbi portd ,5
jmp start

After the code, the light remains turned on, but if the sensor sends '80' 
and I get it correctly it should be turned off.
Question: Am I Using the write way to read a pin?

user1498: You are simply reading the state of the input pin - this won't work.
Study the datasheet for the DHT22, available from Sparkfun or eslewhere.
To get data from the DTH22, you must first send a start signal, wait a specified time, then watch the level of the data line, measuring the time of each bit to determine whether it is a 1 or 0, and store the bits in five 8-bit variables.  You can then examine those variables to determine the temperature and humidity.

user30199: Instructions for writing to an individual output bit:-
 sbi portd,5 ; make Port D output bit 5 high (set)

 cbi portd,5 ; make Port D output bit 5 low (clear)

 sbi pind,5  ; toggle Port D output bit 5 (low -> high, high -> low)

Instructions for reading an individual I/O pin:-
 sbis pind,2 ; skip next instruction if Port D pin 2 is high  

 sbic pind,2 ; skip next instruction if Port D pin 2 is low


40455: <p>I am creating a project in which an Arduino reads (gets) a value from
a DHT sensor. The DHT sensor returns two values:</p>

<ol>
<li>Temperature</li>
<li>Humidity </li>
</ol>

<p><a href="https://i.stack.imgur.com/pJCcg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pJCcg.png" alt="enter image description here"></a></p>

<p>My assembly code:</p>

<pre><code>sbi ddrd,5
cbi ddrd,2
sbi portd,5

start:

in r16,Pind2
cpi r16,80
brne On

jmp start

On:
cbi portd ,5
jmp start
</code></pre>

<p>After the code, the light remains turned on, but if the sensor sends '80' 
and I get it correctly it should be turned off.</p>

<p>Question: Am I Using the write way to read a pin?</p>
 1498: <p>You are simply reading the state of the input pin - this won't work.</p>

<p>Study the datasheet for the DHT22, available from Sparkfun or eslewhere.</p>

<p>To get data from the DTH22, you must first send a start signal, wait a specified time, then watch the level of the data line, measuring the time of each bit to determine whether it is a 1 or 0, and store the bits in five 8-bit variables.  You can then examine those variables to determine the temperature and humidity.</p>
 30199: <p>Instructions for <strong>writing</strong> to an individual output bit:-</p>

<pre><code> sbi portd,5 ; make Port D output bit 5 high (set)

 cbi portd,5 ; make Port D output bit 5 low (clear)

 sbi pind,5  ; toggle Port D output bit 5 (low -&gt; high, high -&gt; low)
</code></pre>

<p>Instructions for <strong>reading</strong> an individual I/O pin:-</p>

<pre><code> sbis pind,2 ; skip next instruction if Port D pin 2 is high  

 sbic pind,2 ; skip next instruction if Port D pin 2 is low
</code></pre>
