Go Down

Topic: How works digital input/output (Read 418 times) previous topic - next topic

kesrut

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 ?

lloyddean

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

MarkT

release as in high-impedance state?
[ I won't respond to messages, use the forum please ]

kesrut

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.


Go Up