This story will be full of intrigue, conspiracies, disappointments, tears and sincere joy ... But, by the way, I got carried away a little - there won't be anything like that.
Background: I have an elderly mother who lives in another city. And he cures his ailments with aloe. The method helps a lot - and she constantly plants new shoots to replace the spent ones. She has 2 representatives of the tailed fauna: Kuzya and Marek (cat and kitty). Why the cat suddenly became "Marek" is a long story. Let us briefly designate the reason as "because the stars were formed this way." I mean, let's make the assumption that Cat cat = new Cat ("Marek");
I would like its guests to treat the growing flora with appropriate respect. For example, like this:
However, they are related something like this:
During the year, a lot of approaches were tried, such as: teach, scold, close the door to the room ... Nothing helps. The result is always the same - only stretched over time.
. : . .
, , : , - : " () LOL! ""! - ... , , . , ( ):
;
(, , - 100 , 2-3 );
.
, - . ...
, - ... ...
( , , ) :
- ,
- ,
- , - .
, , "" . - .
, - . 3d :
: (, - ) ( , , - 30,5):
, : , ( ) - . " "...
. , - ^_^
, - ...
... "" - :
. - (LOL):
. ! !
: : . , :
" anti-access/area-denial A2/AD, , - , ".
, , , "-" - , . : :
, 0,3 - ! ( - (LOL, - )- .. , . - " " - ( , (500 ) - , , ""). , " - ": :
"" ( 2101).
P.S. - . - ? LOL.
, :
, " ". " ".
" ". , ...
- .. .
, "-".
:
- " "- , 3-5 ;
, ( "" ). - 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;
}
}
You can download files for 3d printing at this link .
That's all - the report is finished.