Go Down

Topic: Designing optocoupler circuit for arduino input (Read 8680 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy