there.
added picky, YouTube clip and the suggested readability improvements to the code.
[youtube]0KEOICK4tKA[/youtube]
Also, out of curiousity, why does communication need to open and close in that loop and not just remain open?
that's just the way the PS2 packet works. the packet will start when the Attention line goes low and finishes when it goes high (whether all requested data has been sent or not).
or do you mean "why are there multiple calls to the function gameByte ?"?
gameByte is called once per byte. one byte is sent to the controller and one bye is received from it.
after the 3 byte header gameByte is called once more per data byte.
Perhaps the PS2 controller initialization should be made as a separate function (like gameByte()) so that it can be called?
yea. i was thinking that myself but could not be bothered rewriting it just now. maybe in the future.
if anyone else feels the need to adopt this project then feel free to make it more user friendly.
dunk.