Go Down

Topic: Designing optocoupler circuit for arduino input (Read 6724 times) previous topic - next topic

retrolefty


If I use the internal pull up resistor, then I don't need to connect the Vcc as well right? Just connect the emitter to ground n collector directly to input pin?

In case I need to use an entire port as input with pull up resistor, then will this code work,
Code: [Select]
DDRL = 0x00;
PORTL = 0xFF;



Yes, but be aware that by using direct port commands you lose portability between boards using different controller chips say like between a Uno board and a Mega board. If speed of I/O is important to meet a application requirement then direct port commands may be the best or only method to use, but if speed is not important or can be satisfied with the standard arduino I/O commands then use them.

Lefty

Go Up