Go Down

Topic: Serial port busy problems using Processing and Arduino (Read 34016 times) previous topic - next topic

AneBane

Hi there,

I am making a project, where I am trying to use processing and my Arduino together. I am fairly new in both of the programs.
I haven't had problems with the Arduino program saying that my serial port was busy, until I started using Processing.
But when I started using Processing, at first the problem appeared in that program, and when trying to fix it, it started appearing in Arduino as well. So now I am stuck.

This is what I have tried so far:
I tryed re-installing Processing without luck.
I don't have the two programs open at the same time, so that is not the problem either.
I read a tutorial advising you to go into Terminal and type :
sudo mkdir /var/lock 
sudo chmod a+rw /var/lock
- But that didn't change anything either.

This is what my code looks like:
import processing.serial.*;
Serial port;
float brightness = 0;

void setup()
{
  size(500,500);
  port = new Serial(this, "/dev/tty.AnesIphone-Wirele", 38400);
  port.bufferUntil('\n');
}

void draw()
{
background(0,0,brightness);
}

void serialEvent (Serial port)
{
  brightness = float(port.readStringUntil('\n'));
 
}
Thank you in advance !

Robin2


the Arduino program saying that my serial port was busy,

How, exactly does the Arduino program say this - do you mean the Arduino IDE is giving an error message? Or have you some code in your Arduino sketch that checks the serial port - if so post the sketch.

This seems an unusual name for a serial port
Quote
/dev/tty.AnesIphone-Wirele


What PC and what operating system are you using and why is that the name of the port?
Does that port name also show up in the Arduino IDE?

Sometimes going into System Monitor and killing any Java processes can help - but be careful if you are running other Java based programs that have nothing to do with the Arduino.

I haven't used Processing but I have had no trouble with the Arduino IDE and a JRuby program (which uses the JVM) that communicates with the Arduino Uno.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

steinie44

In setup try:

Port = new Serial(this, "COM5", 115200);

Only use the same COM port and baud rate as the Arduino is using.

wmj259

Go to your task manager and delete all java.exe processes. Rerun your sketch.

tenzin

 i think in ur arduino ide software where u write the code, from there go to tools and click on  Board and choose ur arduino board if ur using the arduino uno or arduino nano etc are there..

oa998

I know this post is 2 years old, but I just encountered this problem.

You can't have the Serial Monitor and your Processing code running at the same time.  The COM can only work for one at a time. 

Modify your Arduino code to give you feedback another way, such as your LED on pin 13.  Use this to determine if your Processing output is reaching your device.

Go Up