All Projects → REVrobotics → SPARK-MAX-Examples

REVrobotics / SPARK-MAX-Examples

Licence: BSD-3-Clause, Unknown licenses found Licenses found BSD-3-Clause LICENSE.txt Unknown LICENSE-FIRST.txt
Example code for SPARK MAX

Programming Languages

LabVIEW
32 projects
java
68154 projects - #9 most used programming language
C++
36643 projects - #6 most used programming language

SPARK-MAX-Examples

Table of Contents

Installing libraries for Java/C++

Download the SPARK-MAX-roboRIO-SDK from RevRobotics.

Extract the zipped archive to a location where you can find it. Within the extracted folder, there will be two folders title "maven" and "vendordeps".

alt text

Copy and paste these folders into the location C:\Users\Public\wpilib\2020. Replace the files in the destination if you are prompted.

alt text

Installing in Visual Studio

Once the archive containing the SPARK-MAX-roboRIO-SDK has been extracted to the correct location, it can be installed in Visual Studio.

Begin by creating a new project in the language of your choice or by opening an existing project. Press ctrl + shift + p to bring up the command pallette and select WPILib: Manage Vendor Libraries

alt text

Then select Install new libraries (offline), check the box next to RevRobotics and select OK.

alt text

After a few moments SPARK MAX libraries will be available for you to use in your current project. This process will need to be repeated for each subsequent project that requires SPARK MAX libraries.

For Java all functions can be imported using import com.revrobotics.*;. Similarly, for C++ use #include "rev/CANSparkMax.h.

Building and Running Examples in Visual Studio

After cloning this GitHub repository, Java and C++ examples can be opened in Visual Studio by going to File->Open Folder... and selecting the parent folder of the example you want to run.

By default, the Team Number is set to 0 in the .wpilib/wpilib_preferences.json file. Make sure to change this to the Team Number configured on your roboRIO by either editing this file directly or by pressing ctrl + shift + p and selecting WPILib: Set Team Number.

Installing libraries for LabVIEW

Download the SPARK MAX LabVIEW API from RevRobotics here.

Simply run the installer and follow the instructions on screen.

Running Examples in LabVIEW

Open LabVIEW and select File->Open Project.... Open the .lvproj file in the top directory of the example you wish to run.

By default the IP address of the roboRIO is set to 172.22.11.2. This IP address will work if you are connecting to the roboRIO over USB, but if you are connected over ethernet or WIFI you will need to right click Target, select Properties, and configure the IP set for your roboRIO.

alt text

Run the program by opening Robot Main.vi a pressing the white arrow at the top of the window.

alt text

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].