Arduino + Processing + RGB Led

Me again :slight_smile:

So I’ve got some code that imports tweets, categorizes them by emotion and finds the most felt emotion.

Now I want to connect Processing to my Arduino to make an RGB led represent this most felt emotion.
Sadly, I have no clue to how to set these RGB values.

For the moment I just let Processing print the name of the color I want the led to be. But I would like them to change the LED to a set color.

if(emotionMost == "Happy") {
  print(" Yellow "); 
} else if (emotionMost == "Confused") {
  print(" Blue ");
} else if (emotionMost == "Interest") {
  print(" Green ");
} else if(emotionMost == "Bored") {
  print(" Red ");
} else if(emotionMost == "Hungry") {
  print(" Orange ");
} else {
  print(" White ");
}

This is my Arduino sketch at the moment:

int incomingByte;      // a variable to read incoming serial data into

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT); // Blue
  pinMode(10, OUTPUT); // Green
  pinMode(11, OUTPUT); // Red
 
}

void loop() {

  if (Serial.available() > 0) {
    incomingByte = Serial.read();
    if (incomingByte > 1) {
      digitalWrite(incomingByte, HIGH);
      delay(100);
      digitalWrite(incomingByte, LOW);
    }
  }
}

These are the RGB values I would like the emotions to have.

Bored - RED = 255 0 0
Hungry - ORANGE = 255 102 0
Happy - YELLOW = 255 255 0
Interest - GREEN = 0 255 0
Confusion - BLUE = 0 0 255
Default - WHITE = 255 255 255

Thank you for your time and effort.

If it was me, I'd probably send the initial letter of the colour (R,O,Y,G,B,W) and let the Arduino work out what to do.

Me again

It's your first post.