Color randomizing time reaction game

Hello all,

I am relativity new to Processing and I have challenged myself to evolve a previous art project into a game based on reaction time. Below is an image of this project with my Processing interface open on the computer:

(Refer to IM 1 Below)

So essentially, I want to turn this from an interactive art display into a color game, in which through the Processing Interface, a player is given a target color and has to quickly press a button whenever the color becomes visible. Here is a quick sketch to help visualize:
(Refer to IM 2 Below)
On the left is the physical table & on the right is what I am trying to create with Processing.

I’d like to have Processing cycle through 6 RGB colors on a fixed time rate for the first round. If the user presses the button while the target color is visible, the round will end and the first light in the bottom right corner of the table will illuminate. Then, the second round starts, following a similar pattern except with a shorter time rate to react. If the user presses the button while the target color is not visible, I would like to un-illuminate lights displayed on the table. For example:

A start button is pressed. The target color “red” is given. Processing begins cycling through the 6 colors every 3 seconds. Red appears, the user presses the button, and processing sends a signal to Arduino to light up the first light. Second round starts, colors are cycled through quicker with an updated target color for the player. This repeats until the whole table is illuminated or the player gives up.

Here is an image of what I’ve created so far:
(Refer to IM 3 Below)

At the moment it does absolutely nothing except for looking like so^. With my mediocre experience programming, I know they’re many ways I could approach this, however I’m so uncertain how I should dive in. What would be most valuable at my current stage would be some guidance in the right direction. These are some questions I have yet to answer:

How do I cycle through the 6 colors?
How do I have Processing respond with true when the button is pressed at the right time and false otherwise?
How do I implement a Timer to help accomplish this?

I know this post contains a lot of words with not many specific questions, however any advice or suggestions will be much appreciated. I have spent hours today trying to break this down but it has drove me crazy, hence the reason why I’m here.

Thank you all in advance (also I hope this post is not disobeying posting guidelines in any way, first timer here)

edit: would only let me post 1 image, so I combined them together below:

1 Like
// -------------------------------------------------------------------------------
// color constants

final color WHITE  = color(255);
final color BLACK  = color(0);

final color DARKGRAY = color(110); 
final color LIGHTGRAY = color(200); 

final color RED     = color(255, 0, 0);
final color GREEN   = color(0, 255, 0);
final color BLUE    = #0326FF; 

final color YELLOW  = #FFF703; 
final color BROWN = (#B9780D); 

final color[] colList = 

// variables 
int i; 

// -------------------------------------------------------------------------------

void setup() {
  size(600, 600);

void draw() {
  rect(100, 100, 
    200, 200);

// -------------------------------------------------------------------------------

void keyPressed() {


1 Like