How to trigger keypress events in p5.js

I want my code to press keyboard keys if a certain condition is True in p5.js library. For example:

a = true

if (a) {
  // Press UP Key
} else {
  // Press DOWN Key
}

Hi @yashkhasgiwala
I don’t know how you will use it, but I found this. At least this code doesn’t give any error.

1 Like