Final Project Progress – Thais And Armaan

Updated Project Idea:

Our project idea has been modified a bit now and is about creating a driving experience for the user in which the user chooses a circuit in processing and uses a joystick to drive a car (made using arduino) and attempts to finish the circuit shown on their processing screens.

For this week, we managed to figure out how to make the core of our project work. We found out a way to use a joystick as an input and then send that information to processing which then communicates it to the Arduino causing a change in it which we can then use as an output. This was actually so time consuming and we had to wrap our brains around how we could make this possible but eventually we found a library on processing called Game Control Plus and G4P which allowed us to configure processing so that we can design what each button in our joystick would do and this would be stored as a separate library which we could then import into our main processing code and use within it.

Meanwhile, we also started working on our processing interface and set up the following game screens:


  • Contains the main menu for the game in which the player can choose to play the game or read the instructions or change settings
  • The playable component of the game wherein the player chooses the circuit they want to race their car in
  • Details game instructions
  • To change game settings
  • To signify end of game


The following is the code that we have written till now:


For the Joystick:


int ledPin = 4;
float brightness = 0;
void setup() {
  pinMode(ledPin, OUTPUT);
void loop() {
  while (Serial.available()) {
    //get the brightness value from processing
    brightness = Serial.parseFloat();
    if ( == '\n') {
    //turn on the LED with the given brightness
      analogWrite(ledPin, brightness);


Arduino code to test out the effect of a joystick on an LED light and toggle it on or off


import org.gamecontrolplus.*;
import org.gamecontrolplus.gui.*;

import processing.serial.*;

Serial myPort;

ControlDevice cont;
ControlIO control;

float press;

void setup()

  size(360, 200);
  control = ControlIO.getInstance(this);
  cont = control.getMatchedDevice("LED_Input");

  if (cont == null)
    println("not today champ");
  String portname=Serial.list()[0]; 
  myPort = new Serial(this, portname, 9600);

void draw()

public void getInput()
  press = map(cont.getSlider("analog").getValue(), -1, 1, 0, 255);

void serialEvent(Serial myPort) {
  String s=myPort.readStringUntil('\n');
  //write brightness so that Arduino can use it
  myPort.write(press + "\n");

We also created a library called “LED_Input” using the GCP Configurator Example of the GCP Library



  • We set up a notion page to better manage our work flow
  • We sit up a github repo to better manage our coding work flow.

Finally, here is a short video showing the joystick and its interaction with arduino…. and also our excitement :))

Leave a Reply