Pages: [1]   Go Down
Author Topic: How works digital input/output  (Read 285 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I'm trying connect Arduino with ps/2 keyboard. Looks like I don't understand how digital input/output works.

I have instructions what to do:

1)   Bring the Clock line low for at least 100 microseconds.
2)   Bring the Data line low.
3)   Release the Clock line.

How to bring Clock line low for 100 microseconds (with functions pinMode and digitalWrite). And how to release clock line ?
Logged

Des Moines, WA - USA
Offline Offline
God Member
*****
Karma: 25
Posts: 779
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't forget 'millis()' and 'micros()'
Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

release as in high-impedance state?
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Keyboard every time is in READ state.

I looked in other people source code it's:

pinMode(irq_pin, INPUT);
digitalWrite(irq_pin, HIGH);
pinMode(data_pin, INPUT);
digitalWrite(data_pin, HIGH);
attachInterrupt(irq_num, interrupt, FALLING);

So I think YES.
Now Arduino can receive data from keyboard.

And now i want to send some data.. So if i want write 1) 2) 3) steps in code I need to write:

1)
digitalWrite(irq_pin, LOW);
delayMicroseconds(100) ;
2)
digitalWrite(data_pin, LOW);
3)
digitalWrite(irq_pin, HIGH) ;

Does I'm correct ?

Just one question. It's INPUT.. how can i send LOW or HIGH. I though it's possible only with OUTPUT.

Thanks.

Logged

Pages: [1]   Go Up
Jump to: