Advertisement
RuiViana

Exemplo separar um dado da string

Jan 8th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. String str1 = "on1";
  2. char matriz[4];
  3. char lamp[] = {1,2,3};
  4. int Id;
  5. String Str2;
  6. void setup()
  7. {
  8. Serial.begin(9600);
  9. }
  10.  
  11. void loop()
  12. {
  13. str1.toCharArray(matriz, 4);
  14. Str2 = (matriz[2]);
  15. Id = Str2.toInt();
  16. Serial.println(lamp[Id-1],HEX);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement