Quantcast
Channel: Arduino - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 747

Serial Communication.

$
0
0

Hello, the following Code:

void serialEvent(Serial p) { message = myPort.readStringUntil(124); if (message != null) { int messageLength = message.length(); message = message.substring(0, messageLength - 1); println(message); try { elements = split(message, ":"); println(elements[0]+"????"); println(elements[0].equals("Panel")); if (elements[0].equals("Panel") == true) { panel = int (elements[1]); println("Panel = " + str(panel)); } } catch (Exception e) { } } }

Print out to Console:


`Panel:1 Panel???? true Panel = 1

Panel:2

Panel???? false

`

Why the second time 'elements[0].equals("Panel")' is false?

Sincerly Jörg


Viewing all articles
Browse latest Browse all 747

Latest Images

Trending Articles



Latest Images