Upload Code to Your Controller – Piper

LET'S UPLOAD CONTROLLER CODE TO YOUR ARDUINO MICRO

In our last step, we used BlocklyDuino to do what's called "processing." We use BlocklyDuino to start because it uses block coding which is a great way to learn how the code works. What we will use in this next step is called Arduino Create which a cloud based processing program like BlocklyDuino but without block coding. Another popular processing tool is called Arduino IDE which is a program you download to your computer. Moving away from the block coding, we are getting into programs that are used by electrical engineers to create some amazing things!

And guess what? The next step involves Minecraft.

Please follow these links to full tutorials on using Arduino Create as well as downloading Arduino IDE.

Click OPEN CODE in the embedded Arduino Create window to the right and add then ADD TO MY SKETCHBOOK. Connect the USB from your Command Center to the computer you are using, then SELECT THE BOARD OR PORT the Arduino Micro is connected to. Lastly, hit the right arrow button to UPLOAD AND SAVE. This will transfer the code to your Piper Command Center.

Curious about what's in the code you're uploading? In addition to the annotations in the code, here's a quick guide:

Lines 2-3

Pull the libraries, files written in C or C++ which provide your sketches with extra functionality. Use Keyboard which programs keystrokes sent and Mouse which controls cursor movement on an attached computer.

Lines 6-23

This maps where each of buttons are plugged into the Micro pins

A0 A1 D13
D7 D8 D9 D6

Lines 99-105

If joystick is pressed down, then the joystick controls (vertical/horizontal) kick in

Pressed Not Pressed

Lines 60-72

Lines 46-59

Lines 109-125

Codes how the XY potentiometers map onto analog displays

Lines 128-183

These lines code the correct pins to the components of the keyboard and mouse libraries.

Lines 204-226

Release the buttons that were selected (essentially an OFF switch for each button)

Lines 228-243

Slow down the mouse movement by adding a delay so the joystick isn't too sensitive

Lines 248-269

Define that each of the buttons are inputs being used by the code.

Coding Complete!