Hi !
I need some help, because I can't understand where is the problem, why I can't convert String to int ?
Part of code :
int octetReception=0;
char caractereRecu=0;
String chaineReception="";
int compt=0;
...
void loop() {
chaineReception="";
// RECEPTION
while (Serial.available()>0) {
octetReception=Serial.read();
compt=compt+1;
if (octetReception==10) {
compt=0;
break;
}
else {
caractereRecu=char(octetReception);
chaineReception=chaineReception+caractereRecu;
}
}
// TRAITEMENT
if (tr1==true) {
tr1=false;
pos1=int(chaineReception);}
else if(tr2==true) {
tr2=false;
pos2=int(chaineReception);}
...
The error message is :
BCI_v2.ino: In function ‘void loop()’:
BCI_v2.ino:112:33: error: invalid cast from type ‘String’ to type ‘int’
BCI_v2.ino:117:33: error: invalid cast from type ‘String’ to type ‘int’