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?

pindandportdbackwards (port is for writing, pin is for reading). Secondly you haven't defined in your code what half of the stuff is (what isddrd, what isportd, what isPortd2). Thirdly you are reading in theportdregister (not an input), and then comparing it directly to a number (decimal 80, hex 0x50) - even if we assume you mean to read the inputs (pind), you haven't connected most of the pins on that port so who knows what value will return. – Tom Carpenter Dec 02 '17 at 15:49in r16, PIND, assuming you are using avr-gcc. If you want just the bit 2,andi r16, 1<<2. – Tom Carpenter Dec 02 '17 at 20:24