Skip to content

3. Setup

Thomas edited this page Oct 14, 2025 · 5 revisions

Getting Started

On the laptop provided to you, search for "vs code" in the Windows search, and you should see 2025 WPILib VS Code appear. Click on it, and it will open. You should see a welcome screen that looks like this:

If you see code or something else, click the File button at the top, and choose Close Folder at the bottom of the list.

Now, from the File menu, select Open Folder, and double click This PC, then C:, Users, NoMythic, and finally single click JavaPlayground and press the Select Folder button on the pop-up window.

Now you should see JavaPlayground on the left side of the screen, along with some other folders. Click the arrow next to src to expand the folder, then double click on App.java to open it. Once it opens, the code view should contain this:

public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello World!");
    }
}

In order to check everything so far, either click the gray Run text inside the editor, or the Run->Run Without Debugging option in the top menu. If all goes well, you should see a window pop-up at the bottom of your screen with Hello, World! displayed in it!

As you can see, System.out.println is a way we can get output from our program when it runs. In this case, it prints out any string (text) which is contained within the quotation marks. You will also be writing all of your code within the main method, which is the place where all Java programs start running. Java uses curly braces { and } to separate logical blocks of code, so in this example the "print" statement is contained inside the main method. Don't worry too much about the public static void main(String[] args) throws Exception line for now, but feel free to look it up if you are curious!

Next it's time to test our connection to the Circuit Playground. After the System.out.println("Hello, World!"); line, add a new line that says JavaPlayground board = new JavaPlayground(""); You may see some red lines underneath the occurrences of JavaPlayground. To fix these, either hover over JavaPlayground, select Quick Fix and then Import JavaPlayground (org.mythicalrobotics), or add the line import org.mythicalrobotics.JavaPlayground; to the top of your file. This tells the Java compiler that some additional code is needed in order to run this program. Now, your code should look like this:

import org.mythicalrobotics.JavaPlayground;

public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello World!");
        JavaPlayground board = new JavaPlayground("");
    }
}

You may have noticed that the two lines in the main method both end in semicolons, and also that they are indented. In Java, semicolons indicate the end of a statement, and so are needed after almost every line. Check what happens if you delete one of them! Indentation using the Tab key is not required for the program to function, but improves the legibility when the code gets more and more complicated. Suffice to say, it is a good habit to get into.

Next we need to tell the code where to find our Circuit Playground board. If you haven't plugged it in to your computer yet, you should do so now. In order to see what name the computer has given to the Circuit Playground, open Device Manager by searching for it by clicking the Windows icon at the bottom or pressing the Windows key and typing device manager. In the list, there should be an option labelled Ports (COM & LPT). Expand the view, and you should see a USB Serial Device listed like so:

In my case, COM4 is the name allocated to my Circuit Playground, but yours will most likely differ. Now go back to VS Code, and type COMX inside the quotation marks of the JavaPlayground line, where X is the number that showed up in your Device Manager. For example:

JavaPlayground board = new JavaPlayground("COM4");

Now that you've added the port name to your code, try running it again. You should hear a beep come from your Circuit Playground!

Next steps

Now, we need to learn about what other hardware we can use, and we need to learn a bit more Java along the way. We are going to do these things together by having you build on a simple program step by step.

Clone this wiki locally