Pages: 1 [2]   Go Down
Author Topic: Designing optocoupler circuit for arduino input  (Read 5879 times)
0 Members and 1 Guest are viewing this topic.
Left Coast, CA (USA)
Offline Offline
Brattain Member
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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,
DDRL = 0x00;

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.


Pages: 1 [2]   Go Up
Jump to: