Go Down

Topic: Need help in processing !! (Read 783 times) previous topic - next topic

AlienArea51

Hi
How can i do , Arduino send value to processing and after recieve this value on Processing ,I shall wish to make this :
Code: [Select]

int val=port.read();
String[] valsondes =Integer.toString(val);

saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);


But that does not work, because " cannot convert from String to String[] "
Please how to make ???
Thanks to the advance

P.S: sorry for my English

William

The truth is elsewhere !!

johnwasser

Have you tried this?
Code: [Select]

  int val=port.read();
  String valsondes =Integer.toString(val);
  saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

AlienArea51

HI and thank

YES , that does not work ,because :
saveStrings(String,String[] ).

William
The truth is elsewhere !!

PaulS

Quote
YES , that does not work ,because :
saveStrings(String,String[] ).

What exactly does saveStrings do with the second argument? Perhaps you need to create an array of String objects as well as the String created from the int, and store the one String in the String array, and pass that array to saveStrings.

johnwasser

If you want to initialize an array of strings it would looks something like this:

Code: [Select]

  int val=port.read();
  String valsondes[] = {Integer.toString(val)};
  saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);


If that's all you do with 'val' you don't really need it:
Code: [Select]

  String valsondes[] = {Integer.toString(port.read())};
  saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

AlienArea51

Hi
Thanks to all.
That does not still work  :~
Processing answers:  cannot convert string to string[]

@+
The truth is elsewhere !!

PaulS

Quote
Processing answers:  cannot convert string to string[]

Time to post YOUR code.

johnwasser

I guess I must have the syntax for initializing an element of an object array wrong.  Try initializing in a separate step.

Code: [Select]

  int val=port.read();
  String valsondes[1];
 valsondes[0] = Integer.toString(val);
  saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

AlienArea51

Hi
@johnwasser
Sorry, but that does not still work =(
It's not serious, I shall find another solution.

@paulS
The code was put in the beginning of the post,The rest of the code has no influence  ,It is a question of reading a variable coming from the port of communication ( Xbee).
Thanks to you, to have answered,
cordially William
@+
The truth is elsewhere !!

PaulS

Quote
The code was put in the beginning of the post

No. A snippet of code was posted. You have been given many suggestions since then, and asked to post more code. You haven't done so. Presumably, you are making changes to incorporate the suggestion, but they are not working.

Answer the questions and post some code so we can see that you have implemented the suggestions correctly.

Otherwise, quit complaining that "it still doesn't work".

Go Up