Advertisement
ASHOT1234

Untitled

Jan 20th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void serialEvent() {
  2.   if(Serial.available()){
  3.     while(Serial.available()){      
  4.       input[count] = Serial.read();
  5.       if (input[count] == 'q'){
  6.         Serial.print("Неверный символ '");
  7.         Serial.print(input[count]);
  8.         Serial.println("', попробуйте снова");
  9.         memset(input, 0, sizeof(input));
  10.         count=0;  
  11.       }
  12.       else if (input[count] == ':'){
  13.         Serial.print("счет ");
  14.         Serial.println(schet);
  15.         if (schet==0){
  16.           Serial.println("введи символ между '::'");
  17.           schet = 0;
  18.         }
  19.         else if (schet==1){
  20.           Serial.println("делаем");
  21.           input[count]=input[count-1];
  22.           input[count-1]='0';
  23.           schet = 0;
  24.           count++;
  25.         }
  26.         else if (schet==2){
  27.           Serial.println("ничего не делаем");
  28.           schet = 0;
  29.         }
  30.         else{
  31.           Serial.println("много символов между '::', попробуйте снова");
  32.           memset(input, 0, sizeof(input));
  33.           count=0;  
  34.         }
  35.        
  36.       }
  37.       else{
  38.         count++;
  39.         schet++;
  40.         Serial.println(input);
  41.         //Serial.print(count);
  42.         //delay(5);  
  43.       }
  44.       delay(5);
  45.     }      
  46.    
  47.     if (count == 16){  
  48.       memset(input, 0, sizeof(input));    
  49.       count=0;
  50.       schet=0;
  51.       huyak();
  52.     }
  53.   }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement