arduino, eletrônica, robotica...
Ola Pessoal.
Estou com dificuldades para fazer as seguintes conversoes:
String a deve converter para Int
String b deve converter para Byte.
{
String CMDRead[10];//String d 10 caracteres q contem Letras e numeros
String a = CMDRead.substring(4,7); //String d 3 caracteres q contem sempre um numero entre 0 e 255
String b = CMDRead.substring(7,10);//String d 3 caracteres q contem sempre um numero entre 0 e 255
}
Tags:
MySpace Tweet Facebook Facebook
Exibições: 3159
▶ Responder esta
RESOLVIDO!!!
Creditos: JONATAS
//getInt Class
int getInt(String texto) // converte uma string em inteiro{ int temp = texto.length() + 1; char buffer[temp]; texto.toCharArray(buffer, temp); int num = atoi(buffer); return num;}
▶ Responder
Bom, sou novo aqui, mas já que demorei um pouco até encontrar a resposta,
Acho que o mais fácil é:
byte byteVar = byte(stringVar.toInt());
int aByte = a.toInt();
byte bByte = byte(a.toInt());
RSS
Bem-vindo aLaboratorio de Garagem (arduino, eletrônica, robotica, hacking)
Registre-seou acesse
Or sign in with:
© 2024 Criado por Marcelo Rodrigues. Ativado por
Badges | Relatar um incidente | Termos de serviço
Verifique as configurações do seu navegador ou contate o administrador do sistema.