Last active
August 29, 2015 14:08
-
-
Save elfgoh/298724f27df9c514354a to your computer and use it in GitHub Desktop.
VC0706 library motion detection method debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean VC0706::motionDetected(void) | |
{ | |
if (_read(4, 200) != 4) { | |
Serial.println("in read"); | |
return false; | |
} | |
if (!_verify(VC0706_COMM_MOTION_DETECTED)){ | |
Serial.println("in verify"); | |
Serial.println(_verify(VC0706_COMM_MOTION_DETECTED)); | |
Serial.println("in verify 2"); | |
Serial.println(VC0706_COMM_MOTION_DETECTED); | |
return false; | |
} | |
return true; | |
} |
notthetup
commented
Oct 25, 2014
I am trying to follow the code logic of invocation from !_verify(VC0706_COMM_MOTION_DETECTED)
Based on debug messages and documentation, it seems that the return from this method will be 0 if comms is happening correctly. If that is the case, why is the ! operator used in the 2nd if? If comms happens correctly, this will evaluate to true and subsequently, false will be returned for motionDetected().
PS. I might have made a mistake in my code somewhere. But just wanna make sure my logic is correct so far
Yup. You're right. That seems like a bit weird. It should be _verify(VC0706_COMM_MOTION_DETECTED)
without the !
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment