Create CommSend.java
This commit is contained in:
parent
b69f27edcd
commit
4b62b0ec9c
23
apka_StolowkaZPM/src/CommSend.java
Normal file
23
apka_StolowkaZPM/src/CommSend.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
public class CommSend {
|
||||||
|
|
||||||
|
static OutputStream out;
|
||||||
|
|
||||||
|
public static void setWriterStream(OutputStream out) {
|
||||||
|
CommSend.out = out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void send(byte[] bytes) {
|
||||||
|
try {
|
||||||
|
System.out.println("SENDING: " + new String(bytes, 0, bytes.length));
|
||||||
|
|
||||||
|
// sending through serial port is simply writing into OutputStream
|
||||||
|
out.write(bytes);
|
||||||
|
out.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user