Digital Soccer Draw Serial Port

Posted on
Digital Soccer Draw Serial Port 3,2/5 7685 votes
Active3 years, 7 months ago

I'm attempting to create a data exchange between sensors on an Ardunio (well actually a AtMega328PU based clone built on a breadboard, but I don't believe that that's the source of my problem) and a Processing script, and I'm getting some unexpected results. I was following the method of serial communication detailed here, but I get stuck with what appears to be no data actually traveling over the serial connection.

The Arduino code:

The software is easy to use. It consists of a drawing program and animation module. The sketching module helps you to draw drills set-ups. The animation module takes your workouts to the next level: from sketches to animated clips explaining what your players should do. Agility animation attacking coach coaching conditioning coordination creator database defend designer download draw drawing. For the 3d draw you should have a look on the Processing reference or at this special topic, P3D by Daniel Shiffman. I have not tested the code, but I think that it should work. If you have questions, feel free to ask;D.

And the relevant parts of the Processing code:

And in Processing I get an output of:

Note: I know I have the correct port selected from the list, so that is not the issue.

I've tried debugging the issue and searching the internet for similar problems, both to no avail. Any help on this issue is greatly appreciated, Thanks!

ZRyanZRyan

1 Answer

I would first check if simply sending a simple message from Arduino to Processing works. Try something like this in Arduino:

and this in Processing:

If this simple setup works, you should be fine to move on to the next step and have two way communication. If the above doesn't work then there's something else causing issues with serial communication (in which case please report what errors you're receiving, if any or what behaviour you're experiencing)

Digital Soccer Draw Serial Ports

In case the above works, you can try two way communication. Notice I'm making use of serialEvent() and bufferUntil. It's best to avoid blocking while loops wherever possible.

Arduino code:

Processing code:

George ProfenzaGeorge ProfenzaDigital Soccer Draw Serial Port
37.6k11 gold badges118 silver badges188 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged arduinoprocessing or ask your own question.

You will learn how to make an onscreen button in Processing that affects a physical LED on your Arduino. This is a great sketch to get started with interactions between computers and the real world, and between an Arduino and Processing.

You need:

  • An Arduino Uno

  • An LED

The setup is simple for this introduction to Arduino and Processing, requiring only a single LED.

Insert the long leg of the LED into pin 13 and the short leg into GND. If you don’t have an LED, you can simply monitor the onboard LED marked L.

How to set up the Arduino code

After your circuit is assembled, you need the appropriate software to use it. From the Arduino menu, choose File→Examples→04.Communication→PhysicalPixel to find the sketch.

This sketch contains both Arduino code and the relevant Processing code for the sketch to work (it also has a variation in Max 5). The code beneath the Arduino code is commented out to avoid interfering with the Arduino code.

In older versions of Arduino, the sketch files ended with .pde, which is the Processing suffix. This caused confusion, so now the Arduino suffix is .ino. Different suffixes make it possible to have the Arduino sketch and the Processing sketch in the same place.

Now go through the steps to upload your sketch.

With the Arduino set up to receive a message from Processing, you need to set up the Processing sketch to send a signal message over the same serial port to your Arduino.

How to set up the Processing code

This code is available within multiline comment markers (/* */) at the bottom of the Arduino PhysicalPixel sketch. Copy the code within the comment markers, paste it into a new Processing sketch, and save it with an appropriate name, such as PhysicalPixel.

Click the Run button to execute the Processing sketch, and an applet appears. The applet shows a black background with a gray square in the middle, representing your virtual button. If you move your mouse over the gray square (or pixel), you can see that its edges turn white.

If you then look at your Arduino, you see that whenever your mouse hovers over the gray square, the LED on your board illuminates, giving you a physical representation of your pixel.

If your LED doesn’t light, double-check your wiring:

  • Make sure that you’re using the correct pin number.

  • Make sure that the LED legs are the correct way around.

  • Check that your Arduino code uploaded correctly and that your Processing code has no errors. Note that you cannot upload while the Processing sketch is communicating with your Arduino, so you need to stop the sketch before uploading.