#include String message = "R01:+01;R02:-02;R03:+03;R04:+04;R05:-05;R06:-06;R07:-07;R08:-08;R09:+09;\ ;R10:-10;R11:-11;R12:-12;R13:-13;R14:+14;R15:+15;R16:+16;R17:+17;;R18:+18;R19:+19;R20:-20\ R01:+01;R02:-02;R03:+03;R04:+04;R05:-05;R06:-06;R07:-07;R08:-08;R09:+09;\ ;R10:-10;R11:-11;R12:-12;R13:-13;R14:+14;R15:+15;R16:+16;R17:+17;;R18:+18;R19:+19;R20:-20\ R01:+01;R02:-02;R03:+03;R04:+04;R05:-05;R06:-06;R07:-07;R08:-08;R09:+09;R10:-10"; void setup() { // put your setup code here, to run once: Serial.begin(9600); } void recu(){ int commPosition; String token; int token_entier; do{ commPosition = message.indexOf(':'); if(commPosition != -1) { token = message.substring(commPosition+1, commPosition+4); token_entier = token.toInt(); Serial.println(token_entier); message=message.substring(commPosition+5 ,message.length()); } }while(commPosition>=0); // while(Serial.read()>=0){}; } void loop() { // put your main code here, to run repeatedly: delay(500); recu(); }