Interfacing with p5js pls help

Hi, I'm having trouble with a school project and I really need some help. We're making a smart lamp with an rgb led. We must use p5.js to send information about the colour channels to arduino using p5.serialcontrol as the link between them. What we don't understand is how we can control separately the color channels in arduino with the information from p5.
Thanks, I hope someone can help us!! :slight_smile:

P5js code:

Arduino code:

We connected the RGB led in the 9th, 10th and 11th digital port and we need to change it's color through sliders in p5.

We're having issues understanding how arduino and p5 are connected, since they don't have the same variables and if we have to write the same code [serialPort.write( int(r));] for every slider.

We think [serialPort.write] is linked to arduino by [Serial.read();] but since we have different variables we don't understand how can we send and receive separate values.

If you want help on pastebin, post your question there. If you want help here, post your code HERE.