Hello. I need to convert content of int array to String and put it in to String array.
I was try to use method “String.valueOf(pozitionX)” , but processing give me message: “The type of the expression must be an array type but it resolved to int”. And underline “pozitionX”. Problem is on line number 190. There is the code:
int[] souradniceX=new int[5000];
int[] souradniceY=new int[5000];
boolean[] zvednuti=new boolean[5000];
String poziceXStr[]= new String[5000];
String poziceYStr[]= new String[5000];
String vystup;
String indexStr;
String zvednutiStr;
int asd;
int asb;
int indexX=1;
int indexY=1;
int bx=1;
int ax=350;
int poziceX;
int cx=0;
boolean potvrzeniX=false;
int ay=0;
int by=1;
int cy=0;
int poziceY;
boolean potvrzeniY=false;
int minusX;
boolean tlacPrint;
boolean tlacStop;
boolean tlacDelete;
void setup(){
size(1110,760);
background(190,190,200);
maluj();
for(int hj=0;hj<5000;hj++){
zvednuti[hj]=true;
}
}
void draw(){
kresleni();
tlacitka();
if(tlacPrint==true){
}
if(tlacDelete==true){
maluj();
bx=1;
ax=350;
cx=0;
potvrzeniX=false;
ay=0;
by=1;
cy=0;
potvrzeniY=false;
}
delay(10);
if((indexX==4999)||(indexY==4999)){
for(;;){
println("plno");
tlacitka();
if(tlacPrint=true){
tisknuti();
}
}
}
}
void tlacitka(){
tlacitkoPrint();
tlacitkoStop();
tlacitkoDelete();
}
void tlacitkoPrint(){
if(mouseButton==LEFT){
if((mouseX>30)&&(mouseX<160)&&(mouseY>30)&&(mouseY<180)){
tlacPrint=true;
}
else{
tlacPrint=false;
}
}
}
void tlacitkoStop(){
if(mouseButton==LEFT){
if((mouseX>190)&&(mouseX<320)&&(mouseY>30)&&(mouseY<180)){
tlacStop=true;
}
else{
tlacStop=false;
}
}
}
void tlacitkoDelete(){
if(mouseButton==LEFT){
if((mouseX>30)&&(mouseX<160)&&(mouseY>210)&&(mouseY<360)){
tlacDelete=true;
}
else{
tlacDelete=false;
}
}
}
void kresleni(){
if((mouseX>350)&&(mouseButton==LEFT)){//pokud je tlačíto stisknuto
while(ax<1110){
if((mouseX>ax)&&(mouseX<ax+20)){//porovnání pozice X s myší
poziceX=ax;
if(indexX>1){
if(souradniceX[indexX-1]==bx){
break;
}//souradnice
else{
souradniceX[indexX]=bx;
bx=1;
indexX++;
ax=350;
break;
}//else
}//indexX
else{
souradniceX[indexX]=bx;
bx=1;
indexX++;
ax=350;
break;
}//else*/
}//mouseX>ax
ax=ax+20;
bx++;
// }//neí
}//while
while(ay<760){
if((mouseY>ay)&&(mouseY<ay+20)){//porovnání pozice Y s myší
if(indexY>1){
if(souradniceY[indexY-1]==bx){
break;
}//souradnice
else{
poziceY=ay;
souradniceY[indexY]=by;
by=1;
indexY++;
ay=0;
break;
}
}//indexY>1
else{
poziceY=ay;
souradniceY[indexY]=by;
by=1;
indexY++;
ay=0;
break;
}//else
}//mouse>ay
ay=ay+20;
by++;
}//while
fill(0,255,0);
//poziceX=poziceX;
//poziceY=poziceY+10;
rect(poziceX,poziceY,20,20);
// poziceX=0;
//poziceY=0;
ay=0;
ax=350;
}//stisk
}//void
void tisknuti(){
for(int df=0;df<indexX+1;df++){
poziceXStr[df]=String.valueOf(poziceX[df]);
}
/*for(int as=0;as<indexX+1;as++){
indexStr="cislo v cyklu";
String zvednutiStr="a";
asd=indexX[as];
asb=indexX[as];
poziceXStr=String.valueOf(asd);
poziceYStr=String.valueOf(asb);
}*/
}
void maluj(){
fill(190,190,200);
rect(0,0,1110,760);
fill(0);
line(349,0,349,760);//oddělující čáry
line(348,0,348,760);
line(347,0,347,760);
line(0,500,350,500);//čára pod tlačítky
for(int i=350;i<1110;i++){//čáry na x
line(i,0,i,760);
i=i+19;
}
for(int j=0;j<760;j++){//čáry na y
line(350,j,1110,j);
j=j+19;
}
fill(255);
rect(0,500,347,260);//textové pole dole
stroke(0);
fill(0,200,0);
rect(30,30,130,150);//print button
fill(255,255,102);
rect(30,210,130,150);//delete button
fill(200,0,0);
rect(190,30,130,150);//stop button
fill(255);
rect(190,210,130,150);//nepřiřazené tlačítko
fill(200,0,0);
rect(30,410,42,60);//malá tlačítka
fill(200,0,0);
rect(92,410,42,60);
fill(200,0,0);
rect(152,410,42,60);
fill(200,0,0);
rect(214,410,42,60);
fill(200,0,0);
rect(276,410,42,60);
}
Iam sorry, because name of variables are in another language (Iam from Czech Republic). Please help me.
And its good to say,this code is program for small drawing cnc machine powered by Arduino.
Thanks you