Hi Arduino Forum,
I'm new on Arduino Forum. I'm using Arduino 1.6.4
My problem is as seen in the topic, the same problem many people have, but a little bit different.
I've located the error in the code line that makes issues, I've done some test and the results are very anoying.
Here you have:
In fact, my code doesn't matter , but I'll post it. Now I'm programing a code that reads some characters and numbers arriving throught serial port from a XBee module device and set the respective variable values.
/* ****Comunicación Xbee ****
En este codigo se realiza la comunicación de los módulos Xbee para permitir manipular
parámetros del drone de forma inalámbrica
*/
// Declaración de variables de comunicación Xbee
char ch='0';
char lectura[8]={0,0,0,0,0,0,0,0};
char parametro[2]={0,0};
char medida[6]={0,0,0,0,0,0};
int poslect=0;
long valor;
// Declaración de variables provisional. Variables ya declaradas en el código principal.
int dT1,dT2,altura;
float alfa,pitch_referencia,roll_referencia,yaw_referencia,kp,ki,kd;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available())
{
ch=Serial.read();
Serial.println(ch);
if (ch!='f')
{
lectura[poslect]=ch;
++poslect;
}
else
{
lectura[poslect]='\0';
for (int i=0;i<=1;i++)
{
parametro[i]=lectura[i];
}
for (int i=0;i<=poslect-2;i++)
{
medida[i]=lectura[i+2];
}
valor=atol(medida);
poslect=0;
switch(parametro[1])
{
case 'a': // Alfa. Filtro complementario
alfa=valor;
break;
case 'l': // Altura
altura=valor;
break;
case 'x': // Pitch Reference
pitch_referencia=valor;
break;
case 'y': // Roll Reference
roll_referencia=valor;
break;
case 'z': // Yaw Reference
yaw_referencia=valor;
break;
case 'p': // Ganancia proporcional del control PID. Kp
kp=valor;
break;
case 'i': // Ganancia integral del control PID. Ki
ki=valor;
break;
case 'd': // Ganancia derivativa del control PID. Kd
kd=valor;
break;
}
Serial.print("Parametro : ");
Serial.print(parametro[0]);
Serial.print(parametro[1]);
Serial.print(" : ");
Serial.println(valor);
}
Serial.print("Poslect : ");
Serial.println(poslect);
Serial.print("Lectura : ");
Serial.print(lectura[0]);
Serial.print(lectura[1]);
Serial.print(lectura[2]);
Serial.print(lectura[3]);
Serial.print(lectura[4]);
Serial.print(lectura[5]);
Serial.print(lectura[6]);
Serial.print(lectura[7]);
Serial.println(lectura[8]);
Serial.print("Parametro : ");
Serial.print(parametro[0]);
Serial.println(parametro[1]);
Serial.print("Medida : ");
Serial.print(medida[0]);
Serial.print(medida[1]);
Serial.print(medida[2]);
Serial.print(medida[3]);
Serial.print(medida[4]);
Serial.print(medida[5]);
Serial.println(medida[6]);
Serial.print("Valor : ");
Serial.println(valor);
Serial.println("Siguiente caracter ");
}
}
As I say that code doesn't really matter, the important part is this:
int poslect=0;
Arduino returns 5 exit status error.
I will add a new variable, not used in code.
int poslect=0;
int posicion=0;
Now It compiles well, although that variable is not used.
I add another needed variable to set de finish of a assignment
int poslect=0;
int posicion=0;
int terminado=0;
This variable "terminado" is still not used in the code but Arduino doesn't compile, it returns the same error.
What the f*&k??
I've been using this Arduino in this computer with this Windows XP with no new update for 4 months. The code is right, becouse I had used it but started to make this anoying behaviours. Windows have not changed, I've windows XP x86 (32 bits) and there are no more updates. Arduino is right becouse I can use any other code examples.
I've to send my proyect the next week and this stupid problems were not expected. I will be grateful If anyone could help me.
(Sorry for my bad english)