psxlib
所属分类:游戏机
开发工具:C++
文件大小:0KB
下载次数:0
上传日期:2022-09-03 00:36:13
上 传 者:
sh-1993
说明: arduino的Playstation 1控制器,
(Playstation 1 controller for arduino,)
文件列表:
LICENSE (35149, 2022-09-02)
Psx.cpp (2068, 2022-09-02)
Psx.h (2006, 2022-09-02)
examples/ (0, 2022-09-02)
examples/Psx/ (0, 2022-09-02)
examples/Psx/Psx.ino (3090, 2022-09-02)
keywords.txt (2058, 2022-09-02)
# PSX Library
This is the library originally developped by Kevin Ahrendt made available on GitHub for easy contribution.
This library allows an Arduino to interface with a standard digital Playstation 1 controller. Installation is simple, just place the package into your Arduino Directory\hardware\libraries.
Use of the library is simple, only requiring an initialization, a setup, and then a read command.
The included example shows a simple application of the library.
The pinout for the Playstation controller is available at: http://www.gamesx.com/controldata/psxcont/psxcont.htm
## Commands
```
Psx()
```
Used to initialize the library
Ex:
```
Psx Psx;
setupPins(dataPin, cmndPin, attPin, clockPin)
```
Defines which pins on the arduino are connected to the controller.
Ex:
```
Psx.setupPins(2, 3, 4, 5)
read()
```
Reads the button data from the playstation controller, and returns it as an unsigned integer.
Ex:
```
data = Psx.read();
```
The returned data is an unsigned integer, with each bit representing a specific button. It can be tested using a simple if statement.
Ex:
```
if (data & psxUp)
```
Each button is defined in the library, so there is no need to use hex codes when testing.
```
psxLeft 0x0001
psxDown 0x0002
psxRight 0x0004
psxUp 0x0008
psxStrt 0x0010
psxSlct 0x0080
psxSqu 0x0100
psxX 0x0200
psxO 0x0400
psxTri 0x0800
psxR1 0x1000
psxL1 0x2000
psxR2 0x4000
psxL2 0x8000
```
## Credits
Protocol information based off of Andrew J McCubbin's analysis.
http://www.gamesx.com/controldata/psxcont/psxcont.htm
Part of the library is based on Carlyn Maw and Tom Igoe's work.
http://www.arduino.cc/en/Tutorial/ShiftIn
http://www.arduino.cc/en/Tutorial/ShiftOut
近期下载者:
相关文件:
收藏者: