Created
November 28, 2018 13:59
-
-
Save memish/dbdd371c408edbb5419ec536429ea90d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PrintWriter output; | |
void setup() { | |
// Create a new file in the sketch directory | |
output = createWriter("positions.txt"); | |
} | |
void draw() { | |
point(mouseX, mouseY); | |
output.println(mouseX); // Write the coordinate to the file | |
} | |
void keyPressed() { | |
output.flush(); // Writes the remaining data to the file | |
output.close(); // Finishes the file | |
exit(); // Stops the program | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment