I have a little problem with my code, I am trying to make a project of a scara that makes figures, the code seems to be finished, but when starting the program I get the only and simple errors that are these:
The file “TrayCursor0TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorCir0TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorTri0TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorSqu0TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorGo0TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursor1TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorCir1TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorTri1TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorSqu1TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorGo1TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursor2TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorCir2TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorTri2TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorSqu2TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorGo2TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursor3TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorCir3TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorTri3TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorSqu3TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file “TrayCursorGo3TrayCursorGo3.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
I already tried to put the images in the same file and nothing, change some things in the PImages code and nothing, does anyone have a solution so that I can read the multiple images that are missing?
import processing.serial.*;
import controlP5.*;
ControlP5 cp5;
///Librerías, getUserInput, final Setup, Arduino
import net.java.games.input.*; ///Arduino
import org.gamecontrolplus.*;
import org.gamecontrolplus.gui.*;
import cc.arduino.*;
import org.firmata.*;
ControlDevice cont;
ControlIO control;
Arduino arduino;
float ser1; //Control XBOX
float ser2;
float ser3;
float an1; //Calculo angulos
float an2;
float ra1; //Angulo text
float ra2;
float write1=90; //Servo write
float write2=90;
float write1servo=90;
float write2servo=90;
float write3;
float alfa=0; //Inverse
float beta=0;
float theta1=90;
float theta2=90;
float segLength = 180; //186
float segLength2 = 160;
float x, y, x2, y2, xefector, yefector;
float xefectorINV=180, yefectorINV=160;
String text="90", text2="90";
int circleY; // Position of circle button
int[] circleX = {
400, 400+85, 400+170, 400+255
};
int trajectorybuttonX=725;
int[] trajectorybuttonY= {
85, 85+50, 85+100, 85+150, 85+200
};
int circleSize = 60; // Diameter of circle
float grid=13.333;
float verticediffx=0, verticediffy=0, verticeposx=180, verticeposy=160;
float[] traycirclex, traycircley;
int dibujando=0, dibujarformas=0;
int circulocount=0, circulocount2=0;
float dibujarmemoria1[], dibujarmemoria2[];
boolean dibujarplumon[];
int millismarca=0, millismarcamemoria=0;
int recordx=0, recordy=0;
boolean recording=false, recordbuffer=false, playing=false;
int recordstep=0;
PImage TrayCursor[];
PImage TrayCursorTri[];
PImage TrayCursorCir[];
PImage TrayCursorSqu[];
PImage TrayCursorGo[];
PImage ImageInsert;
String TrayString;
float vertice1x, vertice2x, vertice1y, vertice2y;
float vertice1xa, vertice1ya, vertice2xa, vertice2ya, tri1x=0, tri1y=0, tri2x=0, tri2y=0, tri3x=0, tri3y=0;
float verticebegin=0;
boolean botonmodo1= false, botonmodo2 = false, botonmodo3 = false, botonmodo4 = false, botonServos=false, botonPlumon; //MOUSEOVER 1 Manual 2 Forward 3 Inverse 4 Trajectories || Prender y apagar servos
boolean botonmodo1ON=false, botonmodo2ON=false, botonmodo3ON=false, botonmodo4ON=false, botonServosOn=false, botonPlumonON=false; //CLICK/ON 1 Manual 2 Forward 3 Inverse 4 Trajectories || Prender y apagar servos
boolean botontray0=false, botontray1=false, botontray2=false, botontray3=false, botontray4=false, botonrecord=false, botonplay=false;
boolean botontray0ON=false, botontray1ON=false, botontray2ON=false, botontray3ON=false, botontray4ON=false, botonrecordON=false, botonplayOn=false;
boolean rectOver = false;
boolean plumon = false;
color[] botonColor;
color botonHighlight, botonHighlightON, botonOn, botonOff;
boolean debugging=false;
void setup() {
size(800, 500);
traycirclex= new float[37];
traycircley= new float[37];
dibujarmemoria1= new float[60];
dibujarmemoria2= new float[60];
dibujarplumon = new boolean[60];
TrayCursor= new PImage[4];
TrayCursorCir= new PImage[4];
TrayCursorTri= new PImage[4];
TrayCursorSqu= new PImage[4];
TrayCursorGo= new PImage[4];
for (int loadcounter=0; loadcounter<=3; loadcounter++)
{
TrayCursor[loadcounter] = loadImagesGui("TrayCursor", loadcounter);
TrayCursorCir[loadcounter] = loadImagesGui("TrayCursorCir", loadcounter);
TrayCursorTri[loadcounter] = loadImagesGui("TrayCursorTri", loadcounter);
TrayCursorSqu[loadcounter] = loadImagesGui("TrayCursorSqu", loadcounter);
TrayCursorGo[loadcounter] = loadImagesGui("TrayCursorGo", loadcounter);
}
botonColor = new color[4];
botonColor[0] = 255;
botonOff =color(50);
botonOn =color(255);
botonHighlight =color(100);
botonHighlightON =color(200);
circleY =460;
ellipseMode(CENTER);
strokeWeight(20.0);
stroke(0);
x = (width/2)-73.333;
y = height/2;
x2 = x;
y2 = y;
// control = ControlIO.getInstance(this); ///Arduino
// cont =control.getMatchedDevice("wire2");
// if (cont ==null) {
// println("El control esta descoenctado");
//// System.exit(-1);
// }
println(Arduino.list());
arduino =new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(10, Arduino.SERVO);
arduino.pinMode(11, Arduino.SERVO);
arduino.pinMode(9, Arduino.SERVO);
cp5= new ControlP5(this);
cp5.addTextfield("Servo 1").setPosition(25, 100).setSize(60, 30).setAutoClear(false);
cp5.addTextfield("Servo 2").setPosition(25, 150).setSize(60, 30).setAutoClear(false);
cp5.addBang("Submit").setPosition(25, 200).setSize(60, 20);
cp5.setColorBackground( color( 0, 0, 0 ) );
cp5.setColorForeground( color( 100, 100, 100));
}
public void getUserIn() {
//asignar al valor float
//para tener acceso al control
ser1= map(cont.getSlider("Servo 2").getValue(), -1, 1, 0, 180);
println(ser1);
ser2= map(cont.getSlider("Servo 1").getValue(), 1, -1, 0, 180);
println(ser2);
ser3= map(cont.getSlider("Servo 3").getValue(), 1, -1, 40, 90);
}
void draw() {
update(mouseX, mouseY);
//getUserIn();
background(0);
fill(255);
rect(100, 76, 600, 347);
fill(225);
strokeWeight(1);
rect((width-350), (height/2)-100, 200, 200);
strokeWeight(20.0);
text(ra2, 90, 50);
text("Efector Final", 170, 30);
if ((xefector<=15 && xefector>=0) && (yefector<=15 && yefector>=0))
{
text(xefector, 170, 50);
text(yefector, 250, 50);
} else
{
text("Error", 170, 50);
text("Error", 250, 50);
}
grid();
if(playing==false)
{
if (botonmodo1ON) //Manual
{
if (mouseX<=650 && mouseX>=450 && mouseY<=350 && mouseY>=150)
{
int mouseX2=mouseX-326;
int mouseY2=height-mouseY-250;
beta = acos((sq(segLength) + sq(segLength2) - sq(mouseX2) - sq(mouseY2))/(2*segLength*segLength2));
theta2=(PI/2)-beta;
alfa = acos((sq(mouseX2)+sq(mouseY2)+sq(segLength)-sq(segLength2))/(2*segLength*sqrt(sq(mouseX2)+sq(mouseY2))));
theta1=atan2(mouseY2, mouseX2)-alfa+.5*PI;
write1=((theta1/(2*PI))*360);
write2=(((.5*PI-theta2)/(2*PI))*360);
}
}
if (botonmodo2ON) //Forward
{
write1=Integer.valueOf(text);
write2=Integer.valueOf(text2);
plumon=botonPlumonON;
}
if (botonmodo3ON) //Inverse
{
beta = acos((sq(segLength) + sq(segLength2) - sq(xefectorINV) - sq(yefectorINV))/(2*segLength*segLength2));
theta2=(PI/2)-beta;
alfa = acos((sq(xefectorINV)+sq(yefectorINV)+sq(segLength)-sq(segLength2))/(2*segLength*sqrt(sq(xefectorINV)+sq(yefectorINV))));
theta1=atan2(yefectorINV, xefectorINV)-alfa+.5*PI;
write1=((theta1/(2*PI))*360);
write2=(((.5*PI-theta2)/(2*PI))*360);
plumon=botonPlumonON;
}
if (botonmodo4ON)
{
if (botontray4ON)////////////////////////////////////////////////////////BOTON DE 'GO'
{
if (dibujando==0)
{
delay(200);
verticediffx=vertice2x-vertice1x;
verticediffy=vertice2y-vertice1y;
verticeposx=vertice1x-326;
verticeposy=height-vertice1y-250;
if (botontray2ON)
{
verticeposx=verticeposx+(verticediffx/2);
verticediffx=(vertice2x-326)-verticeposx;
tri1x=vertice1x;
tri1y=vertice2y;
tri2x=verticeposx;
tri2y=vertice1y;
tri3x=vertice2x;
tri3y=vertice2y;
int circulocount=0;
}
dibujarformas=0;
dibujando=1;
} else if (dibujando==1)
{
int steps=24;
int error=1;
int delaydibujar=400;
circulocount=0;
plumon=true;
beta = acos((sq(segLength) + sq(segLength2) - sq(verticeposx) - sq(verticeposy))/(2*segLength*segLength2));
theta2=(PI/2)-beta;
alfa = acos((sq(verticeposx)+sq(verticeposy)+sq(segLength)-sq(segLength2))/(2*segLength*sqrt(sq(verticeposx)+sq(verticeposy))));
theta1=atan2(verticeposy, verticeposx)-alfa+.5*PI;
write1=((theta1/(2*PI))*360);
write2=(((.5*PI-theta2)/(2*PI))*360);
delay(delaydibujar);
if (botontray0ON) //Línea
{
if (abs(verticeposy-(height-vertice2y-250))<=error && abs((vertice2x-326)-verticeposx)<=error)
{
delay(200);
dibujando=0;
botontray4ON=false;
plumon=false;
} else
{
verticeposx=verticeposx+(verticediffx/steps);
verticeposy=verticeposy-(verticediffy/steps);
}
} else if (botontray2ON) //Triangulo
{
if (dibujarformas==0)
{
verticeposx=verticeposx+(verticediffx/steps);
verticeposy=verticeposy-(verticediffy/steps);
if (abs(verticeposy-(height-vertice2y-250))<=error && abs((vertice2x-326)-verticeposx)<=error)
{
dibujarformas=1;
}
} else if (dibujarformas==1)
{
verticeposx=verticeposx-(verticediffx/steps);
if (abs(verticeposx-(vertice1x-326))<=error)
{
dibujarformas=2;
}
} else if (dibujarformas==2)
{
if (abs(verticeposy-(height-tri2y-250))<=error && (tri2x-verticeposx)<=error)
{
delay(200);
dibujarformas=0;
dibujando=0;
botontray4ON=false;
plumon=false;
}
verticeposx=verticeposx+(verticediffx/steps);
verticeposy=verticeposy+(verticediffy/steps);
}
}else if (botontray3ON) //Cuadrado
{
if (dibujarformas==0)
{
verticeposx=verticeposx+(verticediffx/steps);
if (abs((vertice2x-326))-verticeposx<=error)
{
dibujarformas=1;
}
} else if (dibujarformas==1)
{
verticeposy=verticeposy-(verticediffy/steps);
if (abs(verticeposy-(height-vertice2y-250))<=error)
{
dibujarformas=2;
}
} else if (dibujarformas==2)
{
verticeposx=verticeposx-(verticediffx/steps);
if (abs(verticeposx-(vertice1x-326))<=error)
{
dibujarformas=3;
}
} else if (dibujarformas==3)
{
if (abs(verticeposy-(height-vertice1y-250))<=error)
{
delay(200);
dibujando=0;
botontray4ON=false;
plumon=false;
}
verticeposy=verticeposy+(verticediffy/steps);
}
}
else if(botontray1ON)
{
if(circulocount2<37)
{
plumon=true;
verticeposx=traycirclex[circulocount2]-326;
verticeposy=height-traycircley[circulocount2]-250;
delay(100);
circulocount2++;
if(circulocount2==37)
{
circulocount2=1;
dibujando=0;
botontray4ON=false;
plumon=false;
}
}
}
}
//botontray4ON=false;
}
}
}
if(botonrecordON)
{
if(recording==false)
{
recording=true;
millismarcamemoria=millis();
}
if(recordstep<=59)
{
if((millis()>millismarcamemoria+100))
{
dibujarmemoria1[recordstep]=write1;
dibujarmemoria2[recordstep]=write2;
dibujarplumon[recordstep] =plumon;
millismarcamemoria=millis();
recordstep++;
if(recordstep==60)
{
recordstep=0;
recordbuffer=true;
recording=false;
botonrecordON=false;
}
}
}
}
if(botonplayOn)
{
if(playing==false)
{
playing=true;
millismarcamemoria=millis();
}
if(recordstep<=59)
{
if((millis()>millismarcamemoria+250))
{
write1=dibujarmemoria1[recordstep];
write2=dibujarmemoria2[recordstep];
plumon= dibujarplumon[recordstep];
millismarcamemoria=millis();
recordstep++;
}
if(recordstep==60)
{
recordstep=0;
botonplayOn=false;
playing=false;
}
}
}
text("Angulo 1", 10, 30);
ra1=map(((PI/2)*57.295779513)+write1, 0, 180, -90, 90);
text(ra1, 10, 50);
text("Angulo 2", 90, 30);
ra2=map(((PI/2)*57.295779513)+write2, 0, 180, -90, 90);
an1=map(write1, 0, 180, 0.5*PI, 1.5*PI); //Ángulos para simulación
an2=map(write2, 0, 180, 0, PI);
an1=PI-an1;
x2=x+cos(an1)*segLength; // Cálculos para el brazo 2
y2=y+sin(an1)*segLength;
xefector=(x2+cos(an2-PI+an1)*segLength2)-(width-350);
yefector=(y2+sin(an2-PI+an1)*segLength2)-150;
// xefectorINV=(x2+cos(an2-PI+an1)*segLength2)-326.6;
// yefectorINV=(y2+sin(an2-PI+an1)*segLength2)-250;
if (botonmodo4ON)
{
if (verticebegin==2)
{
if (botontray0ON)
{
strokeWeight(1);
line(vertice1x, vertice1y, vertice2x, vertice2y);
strokeWeight(20);
}
if (botontray1ON)
{
strokeWeight(1);
ellipseMode(CORNERS);
ellipse(vertice1x, vertice1y, vertice2x, vertice2y);
strokeWeight(20);
for(circulocount=0;circulocount<37;circulocount++)
{
// strokeWeight(1);
traycirclex[circulocount]=(vertice2x-vertice1x)/2 + vertice1x + ((vertice2x-vertice1x)/2)*cos(radians(circulocount*10));
traycircley[circulocount]=(vertice2y-vertice1y)/2 + vertice1y + ((vertice2y-vertice1y)/2)*sin(radians(circulocount*10));
// if(circulocount>0)
// line(traycirclex[circulocount-1],traycircley[circulocount-1],traycirclex[circulocount],traycircley[circulocount]);
// strokeWeight(20);
}
}
if (botontray2ON)
{
strokeWeight(1);
triangle(vertice1x, vertice2y, vertice1x-(vertice1x-vertice2x)/2, vertice1y, vertice2x, vertice2y);
strokeWeight(20);
}
if (botontray3ON)
{
strokeWeight(1);
quad(vertice2x, vertice1y, vertice2x, vertice2y, vertice1x, vertice2y, vertice1x, vertice1y);
strokeWeight(20);
}
}
}
segment(x, y, an1); //Angulos corresponden a: 0 = 1 1/2 Pi, 180 = 1/2 Pi
segment2(x2, y2, an2-PI+an1);
stroke(93, 167, 255);
strokeWeight(5);
point((x2+cos(an2-PI+an1)*segLength2), (y2+sin(an2-PI+an1)*segLength2));
stroke(0);
strokeWeight(20);
xefector=map(xefector, 0, 200, 0, 15);
yefector=map(yefector, 0, 200, 0, 15);
write1servo=-.000002*pow(write1,3)+0.0016*pow(write1,2)+0.6097*(write1)+.4871;
write2servo=-.000002*pow(write2,3)+0.0016*pow(write2,2)+0.6097*(write2)+.4871;
if(plumon)
write3=40;
else
write3=90;
if (botonServosOn) ///Arduino
{
arduino.servoWrite(10, (int)write1servo);
arduino.servoWrite(11, (int)write2servo);
arduino.servoWrite(9, (int)write3);
} else
{
arduino.servoWrite(10, 90);
arduino.servoWrite(11, 90);
arduino.servoWrite(9, 90);
}
ellipseMode(CENTER);
///////////////////////////Botón Manual
if (plumon)
{
fill(botonOn);
} else
{
fill(botonOff);
}
ellipse(655, 50, circleSize-20, circleSize-20);
text("Plumón", 655, 40);
if (botonmodo1ON)
{
if (botonmodo1)
fill(botonHighlightON);
else
fill(botonOn);
} else
{
if (botonmodo1)
fill(botonHighlight);
else
fill(botonOff);
}
stroke(0);
ellipse(circleX[0], circleY, circleSize, circleSize);
text("Manual", circleX[0], circleY-20);
///////////////////////////Botón Forward
if (botonmodo2ON)
{
if (botonmodo2)
fill(botonHighlightON);
else
fill(botonOn);
} else
{
if (botonmodo2)
fill(botonHighlight);
else
fill(botonOff);
}
stroke(0);
ellipse(circleX[1], circleY, circleSize, circleSize);
text("Forward", circleX[1], circleY-20);
///////////////////////////Botón Inverse
if (botonmodo3ON)
{
if (botonmodo3)
fill(botonHighlightON);
else
fill(botonOn);
} else
{
if (botonmodo3)
fill(botonHighlight);
else
fill(botonOff);
}
stroke(0);
ellipse(circleX[2], circleY, circleSize, circleSize);
text("Inverse", circleX[2], circleY-20);
///////////////////////////Botón Trayectoria
if (botonmodo4ON)
{
if (botonmodo4)
fill(botonHighlightON);
else
fill(botonOn);
} else
{
if (botonmodo4)
fill(botonHighlight);
else
fill(botonOff);
}
stroke(0);
ellipse(circleX[3], circleY, circleSize, circleSize);
text("Trajectory", circleX[3], circleY-20);
///////////////////////////Botón Servos
if (botonServosOn)
{
if (botonServos)
fill(botonHighlightON);
else
fill(botonOn);
} else
{
if (botonServos)
fill(botonHighlight);
else
fill(botonOff);
}
stroke(0);
ellipse(130, circleY, circleSize, circleSize);
text("Servos", 130, circleY-20);
///////////////////////////Botón 0 Trayectorias
if (botontray0ON)
{
if (botontray0)
ImageInsert=TrayCursor[3];
else
ImageInsert=TrayCursor[2];
} else
{
if (botontray0)
ImageInsert=TrayCursor[1];
else
ImageInsert=TrayCursor[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[0]);
///////////////////////////Botón 1 Trayectorias
if (botontray1ON)
{
if (botontray1)
ImageInsert=TrayCursorCir[3];
else
ImageInsert=TrayCursorCir[2];
} else
{
if (botontray1)
ImageInsert=TrayCursorCir[1];
else
ImageInsert=TrayCursorCir[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[1]);
///////////////////////////Botón 2 Trayectorias
if (botontray2ON)
{
if (botontray2)
ImageInsert=TrayCursorTri[3];
else
ImageInsert=TrayCursorTri[2];
} else
{
if (botontray2)
ImageInsert=TrayCursorTri[1];
else
ImageInsert=TrayCursorTri[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[2]);
///////////////////////////Botón 3 Trayectorias
if (botontray3ON)
{
if (botontray3)
ImageInsert=TrayCursorSqu[3];
else
ImageInsert=TrayCursorSqu[2];
} else
{
if (botontray3)
ImageInsert=TrayCursorSqu[1];
else
ImageInsert=TrayCursorSqu[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[3]);
///////////////////////////Botón 4 Trayectorias
if (botontray4ON)
{
if (botontray4)
ImageInsert=TrayCursorGo[3];
else
ImageInsert=TrayCursorGo[2];
} else
{
if (botontray4)
ImageInsert=TrayCursorGo[1];
else
ImageInsert=TrayCursorGo[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[4]);
///////////////////////////Botón Record
if (botonrecordON)
{
if (botonrecord)
ImageInsert=TrayCursorGo[3];
else
ImageInsert=TrayCursorGo[2];
} else
{
if (botonrecord)
ImageInsert=TrayCursorGo[1];
else
ImageInsert=TrayCursorGo[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[4]+50);
///////////////////////////Botón Play
if (botonplayOn)
{
if (botonplay)
ImageInsert=TrayCursorGo[3];
else
ImageInsert=TrayCursorGo[2];
} else
{
if (botonplay)
ImageInsert=TrayCursorGo[1];
else
ImageInsert=TrayCursorGo[0];
}
stroke(0);
image(ImageInsert, trajectorybuttonX, trajectorybuttonY[4]+100);
if (debugging==true)
{
debugging();
}
if(botonmodo1ON)
{
if(plumon)
{
point(xefectorINV,yefectorINV);
}
}
}
void debugging()
{
fill(255);
text(circulocount, 50, 340);
text(circulocount2, 50, 360);
}
void Submit() {
text=cp5.get(Textfield.class, "Servo 1").getText();
text2=cp5.get(Textfield.class, "Servo 2").getText();
println(text);
println(text2);
}
void grid() {
for (int i=0; i<15; i++)
{
for (int j=0; j<15; j++)
{
strokeWeight(0);
float grid1=(width-350)+(i*grid);
float grid2=((height/2)-100)+(j*grid);
rect(grid1, grid2, grid, grid);
strokeWeight(20.0);
}
}
}
void segment(float x, float y, float a) { // Eslabón 1
pushMatrix();
translate(x, y);
rotate(a);
line(0, 0, segLength, 0);
popMatrix();
}
void segment2(float x, float y, float a) { // Eslabón 2
pushMatrix();
translate(x, y);
rotate(a);
line(0, 0, segLength2, 0);
popMatrix();
}
boolean botonmodo1(int x, int y, int diameter) {
float disX = x - mouseX;
float disY = y - mouseY;
if (sqrt(sq(disX) + sq(disY)) < diameter/2 ) {
return true;
} else {
return false;
}
}
void update(int x, int y) {
if (botonmodo1(circleX[0], circleY, circleSize) )
botonmodo1 = true;
else
botonmodo1 = false;
if (botonmodo1(circleX[1], circleY, circleSize) )
botonmodo2 = true;
else
botonmodo2 = false;
if (botonmodo1(circleX[2], circleY, circleSize) )
botonmodo3 = true;
else
botonmodo3 = false;
if (botonmodo1(circleX[3], circleY, circleSize) )
botonmodo4 = true;
else
botonmodo4 = false;
if (botonmodo1(130, circleY, circleSize))
botonServos = true;
else
botonServos = false;
if (botonmodo1(655, 50, circleSize-20))
botonPlumon = true;
else
botonPlumon = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[0]+12, circleSize))
botontray0 = true;
else
botontray0 = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[1]+12, circleSize))
botontray1 = true;
else
botontray1 = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[2]+12, circleSize))
botontray2 = true;
else
botontray2 = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[3]+12, circleSize))
botontray3 = true;
else
botontray3 = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[4]+12, circleSize))
botontray4 = true;
else
botontray4 = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[4]+12+50, circleSize))
botonrecord = true;
else
botonrecord = false;
if (botonmodo1(trajectorybuttonX+12, trajectorybuttonY[4]+12+100, circleSize))
botonplay = true;
else
botonplay = false;
}
void mousePressed()
{
if (mouseX<=650 && mouseX>=450 && mouseY<=350 && mouseY>=150)
{
xefectorINV=(mouseX-326);
yefectorINV=(height-mouseY-250);
if(botonmodo1ON)
{
plumon=!plumon;
if(plumon)
{
point(xefectorINV,yefectorINV);
}
}
}
if (botonmodo1) {
botonmodo1ON=true;
botonmodo2ON=false;
botonmodo3ON=false;
botonmodo4ON=false;
} else if (botonmodo2) {
botonmodo1ON=false;
botonmodo2ON=true;
botonmodo3ON=false;
botonmodo4ON=false;
} else if (botonmodo3) {
botonmodo1ON=false;
botonmodo2ON=false;
botonmodo3ON=true;
botonmodo4ON=false;
} else if (botonmodo4) {
botonmodo1ON=false;
botonmodo2ON=false;
botonmodo3ON=false;
botonmodo4ON=true;
} else if (botonPlumon)
{
botonPlumonON=!botonPlumonON; //Debug de plumon
} else if (botonServos)
{
botonServosOn=!botonServosOn;
}
if (botonrecord)
botonrecordON=true;
if (botonplay)
botonplayOn=true;
if (botonmodo4ON) //Trayectorias
{
if (mouseX<=650 && mouseX>=450 && mouseY<=350 && mouseY>=150)
{
if (verticebegin==0)
{
vertice1x=mouseX;
vertice1y=mouseY;
vertice2x=mouseX;
vertice2y=mouseY;
verticebegin=1;
} else if (verticebegin==1)
{
vertice2x=mouseX;
vertice2y=mouseY;
verticebegin=2;
} else if (verticebegin==2)
{
verticebegin=0;
}
}
if (botontray0)
{
botontray0ON=true;
botontray1ON=false;
botontray2ON=false;
botontray3ON=false;
}
if (botontray1)
{
botontray0ON=false;
botontray1ON=true;
botontray2ON=false;
botontray3ON=false;
}
if (botontray2)
{
botontray0ON=false;
botontray1ON=false;
botontray2ON=true;
botontray3ON=false;
}
if (botontray3)
{
botontray0ON=false;
botontray1ON=false;
botontray2ON=false;
botontray3ON=true;
}
if (botontray4)
{
botontray4ON=true;
}
} else
{
botontray0ON=false;
botontray1ON=false;
botontray2ON=false;
botontray3ON=false;
}
}
PImage loadImagesGui(String ImageString, int loadit)
{
PImage LoadImage;
LoadImage = loadImage(ImageString + loadit +".jpg");
return LoadImage;
}
I hope you can help me, thank you and good night