RuiViana

TesteRCB

Nov 4th, 2016
147
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String Rui = "";
  2. //-----------------------
  3. void setup()
  4. {
  5.   Serial.begin(9600);
  6. }
  7. //-----------------------
  8. void loop()
  9. {
  10.   if (Serial.available())
  11.   {
  12.     char a = Serial.read();
  13.     if (a != '%')
  14.     {
  15.       Rui += a;
  16.     }
  17.     else
  18.     {
  19.       int valorLedAnalogico = Rui.toInt();
  20.       Serial.println(valorLedAnalogico);
  21.       Rui = "" ;
  22.     }
  23.   }
  24. }
RAW Paste Data