I am trying to input a couple of variables at the sketch startup

Hello @laptophead,

A simple example:

// Set Initial Value
// v1.0.0
// GLV 2022-03-04

int value;

boolean set; //default is false

void setup()
  {
  size(100, 100);
  textAlign(CENTER, CENTER);
  textSize(48);  
  }
  
void draw()
  {
  background(0);  
  
  // if set = false
  if (!set)
    {
    fill(0, 255, 0);  
    textSize(48);  
    text(value, width/2, height/2-10);
    return;
    }
    
  // while set = true  
  fill(255, 0, 0);
  text(value, width/2, height/2-10);  
  }    
  
void keyPressed()
  {
  if(!set)
    {
    if (key == '+')
      value++;
    if (key == '-')
      value--;
    value = constrain(value, -10, 10);  
    println(value); 
    if (key == 's') 
      set = true;
    }    
  }

This is useful for a small range of numbers…

There is also:

And lots of other options out there…

Have fun!

:)

1 Like