Wize Programming and Numerical Methods Textbook > Programming Languages
Processing Language Programming
A Processing sketch in Java mode already has a running draw() function. Its counter must increase once when a mouse button is pressed, before the button is released, even if it remains held through many frames.
Complete the name of the Processing event function you should implement: . Enter only the function name, without parentheses.
A Processing Java-mode sketch displays a displacement sensor reading on a vertical scale. The display uses a linear calibration: 0.0 mm corresponds to screen coordinate y=300 px, and 12.0 mm corresponds to y=60 px. No coordinate transformations are applied.
For a sensor reading of 7.4 mm, the sketch calculates:
Java
float displacement = 7.4f; // millimetres
float yScreen = map(displacement, 0, 12, 300, 60);What is yScreen? Answer in pixels, to one decimal place.