Light painting for PixelPusher
Light painting for PixelPusher
Warning: Embedding code files within the project story has been deprecated. To edit this file or add more files, go to the "Software" tab. To remove this file from the story, click on it to trigger the context menu, then click the trash can button (this won't delete it from the "Software" tab).
import javax.swing.*;
import com.heroicrobot.dropbit.registry.*;
import com.heroicrobot.dropbit.devices.pixelpusher.Pixel;
import com.heroicrobot.dropbit.devices.pixelpusher.Strip;
import processing.core.*;
import java.util.*;
DeviceRegistry registry;
boolean ready_to_go = true;
TestObserver testObserver;
PImage myImage;
int xpos = 0;
void setup() {
registry = new DeviceRegistry();
testObserver = new TestObserver();
registry.addObserver(testObserver);
registry.setAntiLog(true);
registry.setFrameLimit(1000);
frameRate(1000);
// get a file to draw.
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
// create a file chooser
final JFileChooser fc = new JFileChooser();
// in response to a button click:
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
// see if it's an image
// (better to write a function and check for all supported extensions)
// load the image using the given file path
myImage = loadImage(file.getPath());
image(myImage,0,0);
size(myImage.width, myImage.height);
} else {
println("Open command cancelled by user.");
exit();
}
image(myImage,0,0);
}
void draw() {
scrape(xpos++);
if (xpos == width)
xpos = 0;
}
void stop()
{
super.stop();
}
import javax.swing.*;
import com.heroicrobot.dropbit.registry.*;
import com.heroicrobot.dropbit.devices.pixelpusher.Pixel;
import com.heroicrobot.dropbit.devices.pixelpusher.Strip;
import processing.core.*;
import java.util.*;
DeviceRegistry registry;
boolean ready_to_go = true;
TestObserver testObserver;
PImage myImage;
int xpos = 0;
void setup() {
registry = new DeviceRegistry();
testObserver = new TestObserver();
registry.addObserver(testObserver);
registry.setAntiLog(true);
registry.setFrameLimit(1000);
frameRate(1000);
// get a file to draw.
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
// create a file chooser
final JFileChooser fc = new JFileChooser();
// in response to a button click:
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
// see if it's an image
// (better to write a function and check for all supported extensions)
// load the image using the given file path
myImage = loadImage(file.getPath());
image(myImage,0,0);
size(myImage.width, myImage.height);
} else {
println("Open command cancelled by user.");
exit();
}
image(myImage,0,0);
}
void draw() {
scrape(xpos++);
if (xpos == width)
xpos = 0;
}
void stop()
{
super.stop();
}
Comments
Please log in or sign up to comment.