Pages: [1]   Go Down
Author Topic: Need help in processing !!  (Read 726 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 5
Posts: 687
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
How can i do , Arduino send value to processing and after recieve this value on Processing ,I shall wish to make this :
Code:
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

Logged

The truth is elsewhere !!

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8854
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried this?
Code:
  int val=port.read();
  String valsondes =Integer.toString(val);
  saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);
Logged

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

Offline Offline
God Member
*****
Karma: 5
Posts: 687
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HI and thank

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

William
Logged

The truth is elsewhere !!

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8854
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
  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:
  String valsondes[] = {Integer.toString(port.read())};
  saveStrings("http://william.favard.perso.sfr.fr/ALIENAREA51/sondesT.txt", valsondes);
Logged

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

Offline Offline
God Member
*****
Karma: 5
Posts: 687
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

@+
Logged

The truth is elsewhere !!

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Processing answers:  cannot convert string to string[]
Time to post YOUR code.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8854
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

Offline Offline
God Member
*****
Karma: 5
Posts: 687
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
@johnwasser
Sorry, but that does not still work smiley-cry
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
@+
Logged

The truth is elsewhere !!

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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".
Logged

Pages: [1]   Go Up
Jump to: