- Home /
Question by
KnightRiderGuy · Oct 08, 2016 at 12:47 PM ·
c#timerif-statementstrackingarduino
If Event Keeps Occurring frequently then Do Something
Sorry for the convoluted title, I could not think of a better or more descriptive one. ;/
Basically lets say I have some input coming into Unity from an external USB device like an Arduino in the form of a character input, When the character is received it basically means that Motion was detected like this:
case 'J':
Debug.Log ("P.I.R. Motion Detected");
KITTmodes KM = FindObjectOfType<KITTmodes> ();
KM.HumanMotionDetected = true;
KM.Curiosity_Inquire ();
//Toggle On Sequential Image Capture from Video Camera
DataHolder DH = FindObjectOfType<DataHolder> ();
DH.SequentialImageCapOn ();
break;
case 'm':
KITTmodes KMloiter = FindObjectOfType<KITTmodes> ();
KMloiter.HumanMotionDetected = false;
KMloiter.Loiter ();
//Toggle off Sequential Image Capture
DataHolder DH2 = FindObjectOfType<DataHolder> ();
DH2.SequentialImageCapOff ();
break;
What I'm wondering is: If there is a good way to track if motion was occurring a lot over a certain amount of time and then "Do Something" like send a notification
Comment
Your answer
Follow this Question
Related Questions
Time is not stopping 2 Answers
Multiple Cars not working 1 Answer
How Do I check if a Bool was True a few moments ago 2 Answers
Distribute terrain in zones 3 Answers
How to add a cooldown sort of thing. 1 Answer