How can I use the input value as a variable with two arguments?

Activate noLoop() in setup(). Then call redraw() from within your createButton()'s callback:

  1. https://p5js.org/reference/#/p5/noLoop
  2. https://p5js.org/reference/#/p5/redraw