Hello,
Explore the resources (tutorials, references, examples, etc.) here:
References:
https://processing.org/reference/keyPressed_.html < Example here
http://www.asciitable.com/
https://en.wikipedia.org/wiki/Escape_character
https://processing.org/reference/String.html
int value = 0;
void draw()
{
fill(value);
rect(25, 25, 50, 50);
}
void keyPressed()
{
//if (key == 32)
if (key == ' ') //same as above
{
println("space");
}
else
{
//if (key == 10);
if (key == '\n'); //same as above
println("line feed");
}
}
You may have to pass a variable to draw() as in the keyPressed() reference.
:)