All posts by Jianjia Xu

Communication Between Processing and a Servo

In this tutorial , you’ll explore the communication by talking with Processing and allow the processing to control the servo.

Parts Required

1. Arduino Kit

2. Servo

3. Jumper Wires

Circuits

3

 

(This circuit is from Vilros Ultimate Starter Kit Guide)

In the end, it should look like this:

2

You see, it’s really very simple to connect the servo to the arduino board.

Now, let’s build the communication!

1. Download Processing.

2. Here is a tutorial from Sparkfun to learn how to build the connection between Arduino and Processing .

3. So far we’ve shown that Arduino and Processing can communicate via serial that allows data to flow both ways. Coming after: making our servo rotate.

Power

Connect the red from servo to +5V on arduino.

Ground

Connect black/brown from servo to Gnd on arduino.

Signal

Connect white/orange from servo to pin~9 on arduino.

ARDUINO CODE

 

This is what your code should look like when you’re done:

5

PROCESSING CODE

This is what your code should look like when you’re done:

6

 

Reference
https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing

http://www.hackerscapes.com/2014/09/lab-4-communicating/