sorry for my imperfect previous request.
The code that place is just an example to generate the error.
I simplify it more ...
I do not want change the contents of aa, I use toUpperCase () on the fly just to the if statement. This works well with Arduino 022, what has changed in Arduino 1.0?
String aa="vr";
void loop(){
      if (aa.toUpperCase()=="VR"){
        .....
      }
}
You've already been told. The toUpperCase() function no longer returns a copy of the String converted to upper case. It now converts the String object it is called for to upper case.
If you want to work on a copy of the String, YOU must copy it.
stemaste:
I do not want change the contents of aa, I use toUpperCase () on the fly just to the if statement. This works well with Arduino 022, what has changed in Arduino 1.0?
Judging by the old code, it used to make a temporary copy:
String String::toUpperCase() const
{
String temp = _buffer;
for ( unsigned int i = 0; i < _length; i++ )
temp._buffer[ i ] = (char)toupper( temp._buffer[ i ] );
return temp;
}
That's really two copies - one in the function and another returned as the result. The authors must have decided that the extra memory wasted by those copies was something you should do explicitly.
Now it just changes the original:
void String::toUpperCase(void)
{
if (!buffer) return;
for (char *p = buffer; *p; p++) {
*p = toupper(*p);
}
}
That uses less memory. And if you want to use it you have to make your own copy - just the one, not two.
thank you for any help,
I think that will solve the problem of "toUpperCase" with this simple function:
void loop(){
      if (ofToUpperCase(aa) =="VR"){
       .....
      }
}
String ofToUpperCase(String js){
 js.toUpperCase();
 return (js);
}
for the setTimeout I have not understood yet.
I use in various parts of my procedure the function setTimeout (milliseconds, functionx) using the fact that the process continues without waiting for the result of functionx.
In this way I generated n procedures that work in parallel and each are different things but with a contemporary result.
for example:
#include <SimpleTimer.h>
SimpleTimer timer;
void setup(){
  for (int pin=3;pin<=9;pin++)
   analogWrite(pin,0);
  for (int pin=11;pin<=13;pin++)
   analogWrite(pin,0);
}
void loop(){
 timer.run();
 timer.setTimeout(1,goLed1);
 timer.setTimeout(1,goLed2);
}
void goLed1(){
int j;
for(j=0;j<=255;j++){
 analogWrite(6,j);
 delay(5);
}
delay(200);Â
 for(j=255;j>=0;j--){
  analogWrite(6,j);
  delay(5);
 }
}
void goLed2(){
int j;
for(j=0;j<=255;j++){
 analogWrite(7,j);
 delay(5);
}
delay(200);Â
 for(j=255;j>=0;j--){
  analogWrite(7,j);
  delay(5);
 }
}
rather than complaining, I am frustrated by having to change a working project only because the developers decided to ignore the past. A function can not 'change in an upgrade, I do another one if it is needed, I think.
Are evident, however, the limits of my knowledge, so take what I say with a grain of salt.
A small note: "And your complaint is?" I do not speak English, I can not tell the difference between irony and sarcasm in your words;-)
 timer.setTimeout(1,goLed1);
 timer.setTimeout(1,goLed2);
Once per millisecond, you want to call goLed1 and goLed2.
void goLed1(){
int j;
for(j=0;j<=255;j++){
 analogWrite(6,j);
 delay(5);
}
delay(200);Â
 for(j=255;j>=0;j--){
  analogWrite(6,j);
  delay(5);
 }
}
This code will take more than 3000 milliseconds to execute. How can you expect to call it once per millisecond?
Is there any other way to get setTimeout functionality as it was before (simpleTimer.h) ?
The original post said:
stemaste:
I found two big surprise for me.
the first: setTimeout is changed, not work like in version 022 =(
Then the poster said:
for the first point instead? any advice?
I went back to the first post, for the "first point". I had to hunt around to for any examples of setTimeout, in the absence of example code.
A small note: "And your complaint is?" I do not speak English, I can not tell the difference between irony and sarcasm in your words;-)
I'm sorry, I was simply asking what the reported problem is. You did not post any example code. How many times do we try to answer posts where a "problem" is reported but without any examples of such a problem?
I guessed what the problem might be, and could only find that what did not compiled under version 0022, now compiles under version 1.0.
It would help in future if you post the code that reproduces the problem, and specify if any additional, non-standard, libraries are used in your code, so that we might install and try them.
Forget the loop, this code is in the midst of a client event, is executed only once.
I launch the two functions in rapid succession with setTimeout.
Result that the two Fuzions are running at the some time.
I do not care how long they work, my procedure is free to accept new connections immediately without waiting for the end of the work of the two functions.
Only one function can execute at a time - either one of the functions called by the Timer class or loop(). Despite what you seem to think you can do, the Arduino does not have a multi-task operating system. It does one thing at a time.
You haven't solved your problem of possibly memory fragmentation but we'll let that pass. Why do you suppose the developers changed the behaviour of the toUpperCase library? Because it caused problems, I am guessing.
stemaste:
for the setTimeout I have not understood yet.
I use in various parts of my procedure the function setTimeout (milliseconds, functionx) using the fact that the process continues without waiting for the result of functionx.
Well, reading up on simpleTimer, it uses polling. So your design criteria will not be met.
Shouldn't you set the timeout first? Anyway, simpleTimer only checks the timer when you call timer.run (). Thus it waits for the functions goLed1 and/or goLed2 to finish. So you most certainly won't get 1 mS timeouts.
you're right, I review the basics of my plan.
Arduino is not multitasking, it is true, I thought it might work with isolated processes simulating multitasking.
but do not see how.
My project is simple in words, I have to wait for commands from the network http or udp and run the play of light that lasts for 5/10 seconds.
I would like to launch the game and go to take care of the network.
I'll have to handle the interrupt at this point ...or turning the soup of functions into a single loop, yuck
stemaste:
My project is simple in words, I have to wait for commands from the network http or udp and run the play of light that lasts for 5/10 seconds.
...
I'll have to handle the interrupt at this point ...or turning the soup of functions into a single loop, yuck
Basically, get rid of the delay() function. I discuss various approaches here:
You don't need a single function. All you need to do is check various things in your main loop, eg.
Has more data arrived?
Is it time to change the light display to the next one in sequence?