strange exporting
in
Integration and Hardware
•
1 year ago
Hi all fellow people,
nellie
I have this interactive animation with pictures.jpg and communication with potentiometer on Arduino. It exports very strange:
on Mac i have all the files exported, but it is running gray squares.
on Windows7 / Lenovo laptop / exports the .exe and all, but says "Missing Virtual Machine"
I just upgraded processing to the newest version...please give me any suggestions on whatever system if you have an idea how i can fix that, before or after the export. Here is the sketch / plz remove the sound and some of the pics/
:
//communication with arduino
import processing.serial.*;
float potValue = 0;
Serial myPort;
//variables for smoothing
long previousMillis = 0;
long interval = 100;
int pokaz1 = 0;
int pokaz2 = 0;
//pictures
PImage pic, picture, pict, p, pictu, pictur;
int position = -750;
float angle = 0.1;
float ngl = 0.01;
float x, y, z;
float x1;
float y1;
float speed = 1.0;
int direction = 1;
int moveTo = -750;
//sound
import ddf.minim.*;
Minim minim;
AudioPlayer groove;
WaveformRenderer waveform;
void setup() {
size (700,490,P3D); // 1280x800 / 800x400/
//arduino
println(Serial.list());
myPort = new Serial(this,"/dev/tty.usbmodem641", 9600);
myPort.bufferUntil('\n');
//images
p = loadImage("boatOneSmall.png");
pic = loadImage("landSea.png");
picture = loadImage("lodkka.png");
pict = loadImage("bird.png");
pictu = loadImage("LongSky.png");
pictur = loadImage("smallEagle.png");
//sound
minim = new Minim(this);
groove = minim.loadFile("waveSound.mp3", 512);
groove.loop();
waveform = new WaveformRenderer();
groove.addListener(waveform);
}
void draw(){
frameRate(30);
//logic module for smoothing
long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
pokaz2 = pokaz1;
pokaz1 = int(potValue);
if (abs(pokaz1-pokaz2) > 10){
//peremesti lodku
moveTo = int(potValue);
}
}
//movement
if (position > moveTo +10){
position -= 10;}
else if (position < moveTo - 10){
position += 10;}
else { position = moveTo;}
imageMode(CORNER);
image ( pictu, position ,0); //LongSky
image(pic, position, 0); //landSea
image(p, x,20); //boatOne
image (pict, x1, 10); //bird
//scale();
image ( pictur, x1*2, y *5); //eagle
//moving boatOne;
x += 3;
y += 0.1;
if (x > width) {
x = -width;
}
//moving bird;
x1 += 5; //x1 = x1+5;
y1 += 0.3;
if (x1 > width){
x1 = - width;
}
if(angle > 0.005){
ngl = - 0.0003;
}
if(angle < - 0.005){
ngl = 0.0003;
}
angle = ngl + angle;
rotateZ(angle);
imageMode(CENTER);
image(picture, 230, 390); //pencil boat;
//light
//directionalLight(0, 101, 0, 255, 200, 255);
spotLight(51, 102, 126, 50, 50, 400,
0, 0, -1, PI/16,1);
}
//arduino in serial port
void serialEvent(Serial myPort) {
String inString = myPort.readStringUntil('\n');
if (inString != null) {
inString = trim(inString);
float pot = float(inString);
potValue = map(pot, 0, 1023, -1740, 0);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
groove.close();
// always stop Minim before exiting.
minim.stop();
super.stop();
}
nellie
1