Advertisement
ApelPro

sorosport_olvasás_lezárókarakterrel

Apr 11th, 2021
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #define LED1 13
  2. #define LED2 3
  3.  
  4. void setup()
  5. {
  6.   pinMode(LED1, OUTPUT);
  7.   pinMode(LED2, OUTPUT );
  8.  
  9.   Serial.begin( 115200 );  
  10. }
  11.  
  12.  
  13. char command[100];
  14. byte commandLength = 0;
  15.  
  16. void loop()
  17. {
  18.   if ( Serial.available() ) {
  19.     command[commandLength] = ( char )Serial.read();
  20.     if ( command[commandLength] == '\n' ) {
  21.      command[commandLength] = 0;
  22.     }
  23.     commandLength++;
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement