Pages: [1]   Go Down
Author Topic: Arduino stoped sending data to processing  (Read 798 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, i am having the problem with arduino and processing.

I have a arduino mega with Sharp IR sensor sensing data to Processing connected to a Processing program running on a MacMini.
The serial speed is 115200,
but the problem is that when I touch the board, I think the USB cable isn't tight enough and it looses connection, so that the Arduino stops sending data to the computer.

So the only way to fix it would be re-opening the processing app.

Any way to fix this, maybe somehow to reset connection on the go of something.
Thanks
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 653
Posts: 50881
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Any way to fix this
Isn't that obvious? Fix the loose connection. Or, quit touching it.

Really, implementing a software solution to "fix" a hardware problem is not the right answer.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

But i'm not sure the problem is this, still trying to figure out the problem.

Could slowing down the transfer speed help?

But is there a way in processing to re-open serial connection if it failed?

Thanks
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 653
Posts: 50881
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But is there a way in processing to re-open serial connection if it failed?
Creating a new instance of the Serial class, after deleting the old one, will re-establish the connection, by resetting the Arduino.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

But i wont face easy access to the arduino board nor the macmini,
so a way i could fo something like

if(myPort1.available()>0) {}
else{
myPort1 = new Serial(this, serial1, 115200);
   myPort1.bufferUntil('\n');

}

then it would try to re-open connection automatically
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 653
Posts: 50881
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so a way i could fo something like
No. Don't do that. That would open a new connection, and reset the Arduino, whenever Processing had finished processing all pending serial data.

You'll need to include some serial-call-and-response (see the Processing example) protocol, where you try, from Processing, to talk to the Arduino. If the Arduino doesn't respond within some period of time, THEN do what you propose.
Logged

Pages: [1]   Go Up
Jump to: