looking to convert a char or bite from serial into a string

how can i convert a char into a string?

what's wrong with what im gathering from the net is not working for me, im having visual studios and or processing sending out this function over serial to the same com port 9 at the same baud rate and i get nothing, the only way this code above will execute is if i change the datatype to char on the arduino side despite the fact that both visual studios 2013 and processing are sending out strings over serial

String id;
int led = 6;   

void setup() {
  pinMode(led, OUTPUT);

void loop()
  id = Serial.readString();
  if (id == "1")
    digitalWrite(led, HIGH);

if (mousePressed == true) 
  {                           //if we clicked in the window
    myPort.write('1');         //send a 1
  } else 
  {                           //otherwise
    myPort.write('0');          //send a 0

/*VisualStudios */

 if (r == "switch") { port.Open(); port.WriteLine("1"); port.Close(); }

hope this helps you help me

You read from the serial port before you know if there is anything to read. The String class can cause memory errors if not used properly.

This thread will show how to read characters (data) from the serial port in a non blocking way into null terminated character arrays (c-strings, note small s).

@FranksDesigNatures, do not cross-post. Other post removed.

im having visual studios and or processing sending out this function over serial

You might be having Processing send data over the serial port, but you are most certainly NOT having Visual Studio write to the serial port. Visual Studio can't even write to the serial port. It doesn't even know anything about serial ports.

What it does do is allow you to write an application that can read from, and write to, a serial port. But, it is NOT Visual Studio that writes to the serial port. It is your application, which is NOT Visual Studio, that is doing the writing.

Processing is NOT writing a String or a string. It is writing ONE character.

The snippet of code from your app is writing the character 1 followed by a carriage return and line feed. You read all that into id, and then expect id to match "1".

If you use String::trim() after you piss away resources on the String class, the resulting trimmed String WILL equal "1".