I have made a Nano send 4 pot values to an Uno please help with code Happy New Year!
So I have made a Nano send 4 pot values to an Arduino Uno over serial but I have a problem: I don't know how to separate these values. Here's the code:
Master:
    int Pot = A0;
    int Pot2 = A1;
    int Pot3 = A2;
    int Pot4 = A3;
    
    void setup() {
      Serial.begin(115200);
    }
    
    void loop() {
      int Value = analogRead(Pot);
      int Value2 = analogRead(Pot2);
      int Value3 = analogRead(Pot3);
      int Value4 = analogRead(Pot4);
      Serial.write(Value); //Write the serial data
      Serial.write(Value2); //Write the serial data
      Serial.write(Value3); //Write the serial data
      Serial.write(Value4); //Write the serial data
      delay(150);
    }

Slave:
    int incomingByte; // for incoming serial data
    
    void setup() {
      Serial.begin(115200); // opens serial port, sets data rate to 9600 bps
    }
    
    void loop() {
      // send data only when you receive data:
      if (Serial.available() &gt; 0) {
        // read the incoming byte:
        incomingByte = Serial.read();
    
        // say what you got:
        Serial.print(&quot;I received: &quot;);
        Serial.println(incomingByte, DEC);
      }
    }

And a bit from the serial logs:

    I received: 255
    I received: 247
    I received: 11
    I received: 0

It updates and sends these four values for the four pots, it can read them but they are together, and it sometimes also kind of lags if I can say it like that; it sometimes takes longer to update but then it goes to normal again.
Thanks!
If your goal is to &quot;talk&quot; to a computer vs. a human, then a format that can be parsed easily is better than one that is easy to read.
For example, you have:
I received: 255
I received: 247
I received: 11
I received: 0

While this could be parsed by your Uno, it will be a lot simpler if you send the data something like:
255|247|11|0

Now you can use a &quot;C&quot; string parsing function like strtok() to parse on the &quot;|&quot; character.  Of course there are many other ways to do this as well but this is one possible solution to your question.