arduino serial to processing

Hi, after reading hundreds of topics I'm more confused than I was before..I need to send multiple data from arduino to processing using serial.

What I need to send is a value that tells when a momentary button was pressed and values in range 0-100 coming from a potentiometer.

This is my code and it's not working when the 2 serial.write are both active

arduino

raw_pot = analogRead(VOLUME);
    volume = map(raw_pot, 0, 1023, 0, 100);
    //Serial.write(volume);

    //change song
    if(next_state == HIGH){
        if(next_lock){
            Serial.write(1000);
            next_lock = false;   
        }
    }else
        next_lock = true;

processing

if(myPort.available() > 0)
        input = myPort.read();
    
    if(input != 232) //I saw that if I send 1000 from arduino, 232 is what will be read by processing
        volume = map(input,0,100,-40,6);
    else
        butt_pushed = true;

thank you

Do you have a clue what the difference between Serial.print() and Serial.write() is? If not, some time at the reference page is in order.

Do you have a clue what type of value Serial.write() takes? If not, some time at the reference page is in order.

Do you know what range of values fit in that type? If not, some time at the reference page is in order?

Why do you need to send data that way? Unconditionally sending anonymous data mixed with conditionally sending anonymous data means that you don't have a hope in hell of parsing the incoming data.

I figured out the best way to do this was just attach the data with Serial.print and separate them with a comma and then extract them in processing with SerialEvent and store them in an array…to be honest I’m still trying to understand the differences between write and print and how the serial comm works and how to translate bytes in ascii and so on…sorry to say this but for a beginner the arduino docs is absolutely too short, not detailed and basically not useful (unless you already know stuff)…if I was a total beginner with coding and my only source was the arduino manual I was probably going nowhere…luckily there are many other and better sources out there…

thanks anyway
L.

to be honest I'm still trying to understand the differences between write and print

The write() method takes a byte, and sends that byte AS-IS to the serial port.

The print() method is overloaded to take a variety of data types. For numeric types, it converts them to strings, and sends the strings, one byte at a time.

byte b = 128;
Serial.write(b); // sends one value, 128, to the serial port
Serial.print(b); // sends three values, '1', '2', and '8', to the serial port.