im making a digital etch a sketch and wanting to save all the sketches i create on it as PNG files. on an old sketch i did i could press S to save the image in my folder. the other problem with that was i could only save one image and it over ritten my old image. im wanting to press a button placed on my etch a sketch to save an image but then forget i saved that image and able to save another image.
if any once can knock up a dummy pice of code for me or has anything similar that i could use i would be very appreciative of it.
i see this is using a mouse press function. i have a pushbutton connected to digital pin 6 how do i get that button to save multiple times. i will be setting this up with no use of the mouse so all interaction needs to be with pushbuttons mounted on my etch a sketch.
Since we don't know how your push button is connected to your computer, and I am generally incompetent in hardware interactions (because I have only standard hardware: mouse and keyboard...), I can't answer. I hope somebody else has an idea.
It saves in the sketch folder by default. Instead of a file name, you can specify an absolute path. Or for something more generic, use System.getProperty("user.home") to get the user's home directory path.
Oh well... Where I wrote the comment "Save image here instead", I meant you should use the save() function in place of the println(), which is there only for verification purpose, and doesn't anything beside writing messages in the console area of the PDE, indeed. My code was intended to show only the counter and file name building.
within my sketch folder once i press the button to save it saves it is. filename.tif. but the code says it should save as a png, and im guessing the counter is counting how many saves i have saved. but this is not working. i have the global variable at the top.
ok silly me. i had to change my button state to LOW.
but now my whole sketch is lagging. any way around it not lagging. iv looked to see how the files save the file looks as though its pre saving its made the file without me actually saving it and when i hit my button thats when its locking the file down as a save. should it do it this way? i think this is whats making it lagg.
thanks for the tips and code supplied PhiLho
Leave a comment on m0401239's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic