You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
762 B

6 years ago
public static final char HEADER = 'H';
public static final char A_TAG = 'M';
public static final char B_TAG = 'X';
void ephSerial() {
for(int i = 0; i<colorsN; i++) {
colorByteValues[i] = byte(colorValues[i]/(cellN/100));
print(colorByteValues[i] + "\t");
}
println("");
6 years ago
sendMessage(A_TAG, colorByteValues);
}
void sendMessage(char tag, byte[] cbv){
// send the given index and value to the serial port
port.write(HEADER);
port.write(tag);
for(int i=0; i<cbv.length; i++) {
port.write(cbv[i]);
}
6 years ago
port.clear();
6 years ago
}
void serialEvent(Serial p) {
// handle incoming serial data
String inString = port.readStringUntil('\n');
if(inString != null) {
print( inString ); // echo text string from Arduino
}
}