JAVA CODE Create a new Transmit Thread in the ConnectPort class. This Thread sho
ID: 3582575 • Letter: J
Question
JAVA CODE
Create a new Transmit Thread in the ConnectPort class. This Thread should transmit out (send) one character every second over the serial port. The sequence of the characters to be transmitted is ‘a’, ‘b’ ‘c’ … until ‘z’ and then start over from ‘a’ again.
THIS IS THE ORIGINAL TRANSMIT THREAD I BELIEVE...
(If anything i just need the logic to program this)
public int sendMessage(String msg)
{
if (serialPort != null)
{
try{
OutputStream out = serialPort.getOutputStream();
byte[] b = msg.getBytes("UTF-8");
out.write(b);
out.flush();
return 0;
}
catch (Exception serialTxExcep){
serialTxExcep.printStackTrace();
}
}
return -1;
}