RuiViana

Lista_Zero_Esquerda.ino

Oct 22nd, 2018
164
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. long valor;
  2.  
  3. void setup()
  4. {
  5.   Serial.begin(9600);
  6.   Serial.println(" Digite um valor  : ");    // Debug
  7. }
  8.  
  9. void loop()
  10. {
  11.   String saida = "";
  12.   if (Serial.available() > 0)
  13.   {
  14.     valor = Serial.parseInt();
  15.   }
  16.   String minhaStr = (String)valor;
  17.   int meuLgh = minhaStr.length();
  18.   for ( int i = 0; i < 5 - meuLgh; i++)
  19.   {
  20.     saida += "0";
  21.   }
  22.   saida += minhaStr;
  23.   Serial.println(saida);
  24. }
RAW Paste Data