Hello
I do not anderstand why when I modify a argument this is not working as I had expected
parameter 1 of the subroutine is a array of char
parameter 2 of the subroutine is an array of string that I wont to modiffy.
I can read the array but I cannot change them.
what am-I doing wrong?
char t1[14]="#aa-1-mod&"; // input
String duree_sv1 = "bbbbbbbbbbbbbbbbbb\0"; // should contain the codified value
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// send an intro:
Serial.println("\n\n subroutine parameters (char, string):");
Serial.println();
}
//
/////////////////////////////////////////////////
//
void aj_dt ( char tv[] , String sx )
{
int i=0;
Serial.print("avant tv= "); Serial.println(tv);
Serial.print("avant sx= "); Serial.println(sx);
sx="llllllllll"; // Modify sx output value
tv="fffffffffff";
}
///////
////////////////////////////////////////////
// Set up a String:
void loop() {
Serial.print("avant t1="); Serial.println(t1);
Serial.print("avant duree_sv1="); Serial.println(duree_sv1);
aj_dt ( t1, duree_sv1);
Serial.print("t1 apres s/r = "); Serial.println(t1);
Serial.print("duree_sv1 apres S/R ="); Serial.println(duree_sv1);
//
// apres l appel la variables reste inchangée pourquoi
//-----------------------------------------------------
// do nothing while true:
while (true);
}