Why cant I display the text of a string made with toString?

edited October 7 in Arduino

got this from the AP-Sync library. building a string that will be sent to Ardu when enter is pressed.

Works great, great library.
However, I want to also display that string on the java, so I can see what I am typing. println, shows it fine, but "text( toArduino, LS4+190, 70);" said that I cant show that.

I also tried to make a new string just for my text such as: String BeforeSending = toArduino;
Not allowed, I get a "Type mismatch, "java.lang.StringBuilder" does not match with "java.lang.String"

Here is the function `

void keyPressed(){ //println("pressed " + int(key) + " " + keyCode); println(toArduino );

String BeforeSending = toArduino;

if (keyCode == ENTER){ println(toArduino + " sent");

  streamer.send(toArduino.toString());
  toArduino.setLength(0);
    fill(y); // Yellow

text("Sent String:", 560, 600 ); // text( toString, 160+150, 600); } if (keyCode == DELETE || keyCode == BACKSPACE){ if(toArduino.length() > 0){ toArduino.deleteCharAt(toArduino.length() - 1); } }

if(keyCode != ENTER && keyCode != DELETE && keyCode != ESC && keyCode != UP && keyCode != DOWN && keyCode != BACKSPACE && keyCode != TAB && keyCode != ALT && keyCode != CONTROL && keyCode != RETURN ){

  toArduino.append(key);

} }`

What to do? I thought that toString will just make me another string that I can play with as I wish...

Thanks

Answers

  • There is a new forum

    Please ask there

    Almost everyone is over there now

Sign In or Register to comment.