Skip to content

Commit c4cdb19

Browse files
Readme
1 parent deedac5 commit c4cdb19

1 file changed

Lines changed: 79 additions & 1 deletion

File tree

README.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,82 @@ Supported link types: SPI, I2C (Untested), UART/Serial (Untested)
55

66
New link types can be easily added by implementing Link
77

8-
[Original Pixy2 Code for C++ Arduino](https://github.com/charmedlabs/pixy2/tree/master/src/host/arduino/libraries/Pixy2)
8+
[Original Pixy2 Code for C++ Arduino](https://github.com/charmedlabs/pixy2/tree/master/src/host/arduino/libraries/Pixy2)
9+
10+
---
11+
## Installing the API
12+
To install the API, it can either be downloaded and copied directly into the project, or you can use it with Gradle/Maven.
13+
14+
The maven repository is located at: https://nexus.otake.pw/repository/maven-public/ The group id is `pw.otake.pseudoresonance` and the artifact name is `pixy2-java-api` For FRC Gradle builds, this can be easily added by adding the following to `build.gradle` in the project's root.
15+
16+
Add `maven { url 'https://nexus.otake.pw/repository/maven-public/' }` under `repositories`
17+
18+
Add `compile 'pw.otake.pseudoresonance:pixy2-java-api:1.0'` under `dependencies`
19+
20+
Your `build.gradle` should resemble this:
21+
22+
```gradle
23+
// Maven central needed for JUnit
24+
repositories {
25+
mavenCentral()
26+
maven { url 'https://nexus.otake.pw/repository/maven-public/' }
27+
}
28+
29+
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
30+
// Also defines JUnit 4.
31+
dependencies {
32+
compile 'pw.otake.pseudoresonance:pixy2-java-api:1.0'
33+
compile wpi.deps.wpilib()
34+
compile wpi.deps.vendor.java()
35+
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
36+
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
37+
testCompile 'junit:junit:4.12'
38+
}
39+
```
40+
41+
---
42+
## Using the API
43+
First create a Pixy2 camera object with `Pixy2 pixy = Pixy2.createInstance(link)` and supply the link type of your choosing. Next, initialize the Pixy2 camera with `pixy.init(arg)`. You can either omit arg, your add a value based on the link type.
44+
45+
The Pixy2 can now be called on with the various provided methods as outlined in the documentation and on the Pixy2 website.
46+
47+
---
48+
## Connecting Pixy2 to RoboRIO
49+
SPI is the recommended link type due to it's higher data transfer rate as well as better implementation in the WPILib API which helps with efficiency.
50+
51+
### SPI
52+
| Pixy2 Port | RoboRIO Port |
53+
| --- | --- |
54+
| 1 | MISO |
55+
| 2 | 5V |
56+
| 3 | SCLK |
57+
| 4 | MOSI |
58+
| 6 | ⏚ Ground |
59+
| 7 | CS0 (Optional) |
60+
61+
**NOTE**: Pin 7/CS0 pin is the optional SPI Slave Select (SS) pin. It can be connected to any SS pin on the RoboRIO, CS0, CS1, CS2 or CS3. If slave select functionality is not needed, set the Pixy2 to use the data output `Arduino ICSP SPI`. Use `SPI with SS` for slave select support. In the code, the slave pin in use can be selected by using an initialization argument of the corresponding pin. 0 for CS0, 1 for CS1, et
62+
63+
### I2C
64+
| Pixy2 Port | RoboRIO Port |
65+
| --- | --- |
66+
| 2 | 5V (from VRM) |
67+
| 5 | SCL |
68+
| 6 | ⏚ Ground |
69+
| 9 | SDA |
70+
71+
**NOTE**: The RoboRIO does not have a 5V output for I2C, and thus, the 5V must be sourced elsewhere, such as from the VRM.
72+
73+
### UART/Serial/RS-232
74+
| Pixy2 Port | RoboRIO Port |
75+
| --- | --- |
76+
| 1 | RXD |
77+
| 2 | 5V (from VRM) |
78+
| 4 | TXD |
79+
| 6 | ⏚ Ground |
80+
81+
**NOTE**: The RoboRIO does not have a 5V output for UART/Serial/RS-232, and thus, the 5V must be sourced elsewhere, such as from the VRM.
82+
83+
#### Pixy2 Pinout
84+
![Pixy2 Pinout](https://docs.pixycam.com/wiki/lib/exe/fetch.php?w=640&tok=f1a03d&media=wiki:v2:image_248_2.jpg "Pixy2 Pinout")
85+
86+
[Pixy2 Connection Guide](https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:i_don-27t_see_my_controller_supported_what_do_i_do "Pixy2 Connection Guide")

0 commit comments

Comments
 (0)