Go Down

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



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 ?


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


release as in high-impedance state?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


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:

digitalWrite(irq_pin, LOW);
delayMicroseconds(100) ;
digitalWrite(data_pin, LOW);
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.


Go Up