Advertisement
RuiViana

TesteRCB

Nov 4th, 2016
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement