"Cat Spraygatron" - o una torreta de batalla contra un gato ^ _ ^

Esta historia estará llena de intrigas, conspiraciones, desilusiones, lágrimas y alegría sincera ... Pero por cierto, me dejé llevar un poco, no habrá nada de eso.

Antecedentes: tengo una madre anciana que vive en otra ciudad. Y cura sus dolencias con aloe. El método ayuda mucho, y constantemente planta nuevos brotes para reemplazar los gastados. Es el hogar de 2 representantes de la fauna con cola: Kuzya y Marek (gato y gatito). Por qué el gato de repente se convirtió en "Marek" es una larga historia. Designemos brevemente la razón como "porque las estrellas se formaron de esta manera". Es decir, supongamos que Cat cat = new Cat ("Marek");





Me gustaría que sus invitados trataran la flora en crecimiento con el debido respeto. Por ejemplo, así:





Sin embargo, se relacionan con algo como esto: 





Durante el año se han probado muchos enfoques, como: enseñar, regañar, cerrar la puerta de la habitación ... Nada ayuda. El resultado es siempre el mismo, solo que se estira con el tiempo.





. : . .





, , : , - : " () LOL! ""! - ...  , , . , ( ): 





  • ;





  • (, , - 100 , 2-3 );





  • .





, - . ... 





, - ... ...





( , , ) :





  • - ,





  • - ,





  • - , - .





, , "" . - .





, - . 3d :





: (, - ) ( , , - 30,5):





, : , ( ) - . " "...





. , - ^_^





, - ...





... "" - :





. - (LOL):





. ! ! 





: : . , :





" anti-access/area-denial A2/AD, , - , ".





, , , "-" - , . : :





, 0,3 - ! ( - (LOL, - )- .. , . - " " - ( , (500 ) - , , ""). , " - ": :





"" ( 2101).





P.S. - . - ? LOL.





, :





, " ". " ".





" ". , ...





- .. .





, "-".





:





  1. - " "- , 3-5 ;





  2. , ( "" ). - ABS - . :





, - , .





Arduino IDE:






int sensor1 = 2 ;//    1
int sensor2 = 3; //    2
int mosfet = 10; //   ,   

boolean isSensorStarted = false; //      
boolean isMotorStarted = false; //      
boolean catStatusMessage = false; //      
boolean isFirstMessage = true; //   

boolean firstStart = true; //      (  )

volatile uint32_t startTime = 0; //  ,   
volatile uint32_t workingTime = 3000; //  ,    

void setup ()
{
  Serial.begin(9600);
  pinMode (sensor1, INPUT) ; //     
  pinMode (sensor2, INPUT) ; //     
  pinMode (mosfet, OUTPUT) ;//     

  attachInterrupt(digitalPinToInterrupt (sensor1), sensor_impulse, HIGH);
  attachInterrupt(digitalPinToInterrupt (sensor2), sensor_impulse, HIGH);
}

void loop ()
{

  while (isSensorStarted)
  {
      if (firstStart) //    ,    -     -   LOW
        {
          detachInterrupt(sensor1);
          detachInterrupt(sensor2);
          while ( (digitalRead(sensor1)==HIGH) || (digitalRead(sensor2)==HIGH) )
          {
            //  -,     LOW
          }
          firstStart = false;
          isSensorStarted  = false;
          Serial.println ("");
          isFirstMessage = false;           
          attachInterrupt(digitalPinToInterrupt (sensor1), sensor_impulse, HIGH);
          attachInterrupt(digitalPinToInterrupt (sensor2), sensor_impulse, HIGH);
          break;                      
        }
    
     if (catStatusMessage)
     {
        Serial.println ("  !!! :-)"); 
        catStatusMessage = false;     
     }

     detachInterrupt(sensor1);
     detachInterrupt(sensor2);
   
     digitalWrite(mosfet, HIGH);
     startTime = millis(); //       
     isMotorStarted = true;
     Serial.println (" !");     
    
     while (isSensorStarted)
     {
        if (isMotorStarted)
        {
          if (millis()-startTime >= workingTime)
          { 
            isMotorStarted=false;
            digitalWrite(mosfet, LOW);
            Serial.println (" !");
          }          
        }

      
      if ( (digitalRead(sensor1)==LOW) && (digitalRead(sensor2)==LOW) )
         {
           attachInterrupt(digitalPinToInterrupt (sensor1), sensor_impulse, HIGH);
           attachInterrupt(digitalPinToInterrupt (sensor2), sensor_impulse, HIGH); 
           isSensorStarted = false;
         }
     }
  }

 if (!isFirstMessage)
 {
    if (!catStatusMessage)
       {
         Serial.println ("   ...:-(");
         catStatusMessage = true;      
       }  
 }
     

}

void sensor_impulse () 
{
  if (!isSensorStarted)
  {
     isSensorStarted = true;
  }
}
      
      



Puede descargar archivos para impresión 3D en este enlace .





Eso es todo, el informe está terminado.








All Articles