How to write my code so that it adjusts to mobile screen for p5.js?

Perhaps this discussion gives you an option how to solve your problem Setting size of display window to a percentage of screen size