We are about to switch to a new forum software. Until then we have removed the registration on this forum.
i am trying make a aplication capable of change between different arduino boards. But before a start a new connection i must close the previous one and i can't find correct whay to do this.
this is my code to connect:
public boolean tentarInstancia(String serial)
{
try
{
//it's work with regular serial communication, but don't work with firmata
arduino.stop();
}
catch (Exception e){println(e.getMessage());}
finally{this.conectado = false;}
try
{
arduino = new Arduino(dad, serial, 57600);
delay(2000);
try
{
definirModosPortas();
}
catch (Exception e) {println(e.getMessage());}
println("conexao com: " + serial + " bem sucedida");
this.conectado = true;
}
catch (Exception e){println(e.getMessage());}
finally
{
if(conectado) this.COM = serial;
else this.COM = "null";
return this.conectado;
}
}
Answers
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
It's just boiler-plate using
this
before a field: :-\"Instead of
this.conectado = true;
, useconectado = true;
.sorry for the formatting, this is my first question.
i already fixed the text
the core of the problem is how to close firmata communication before start a new one