ARDUINO meets PROCESSING

Joystick


navigation

To build the electronic circuit you need the following parts:

The schematic for the circuit looks like this:

scheme for potentiometor

If you have a joystick, you connect 5V to each of two outer pins of the joystick and the other two outer pins are connected to ground. From the two middle pins you connect two wires to the analog pins 2 and 3 of the Arduino board. Consequently, the circuit on your breadboard should look something like this:

picture of joystick circuit

If you don't have a joystick, you can just take two potentiometers simultaneously. Check out the potentiometer circuit and simply connect a second potentiometer to analog pin 3.

If everything is set up right, you can connect the board to the serial (or USB) port of your computer and, if necessary, to the power supply. The power LED should light up and the next step is to export the program which reads the state of the switch to the board. Open the ap_ReadMultiAnalog_2.pde file in Arduino, set the right serial port and baudrate, compile the program, and then press the reset button on your board and click on the export icon to send the program to the board.

Then you download and unzip pa_Joystick.zip and open the file pa_Joystick.pde in Processing. You will have to set the right serial port, which you do by editing the variable portname. Eventually you will also have set the correct baudrate by editing its variable (baudrate).

Now, you can run your Processing program. A new window will open and you should see something like this:

The cursor on the screen is controlled by the joystick. To draw you use the following keys:

It might not be the most powerful drawing application in the world but it works!