Skip to content

Instantly share code, notes, and snippets.

@edalquist
Last active May 18, 2022 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edalquist/ff19ea8a950f4c8fa073acaa393e9465 to your computer and use it in GitHub Desktop.
Save edalquist/ff19ea8a950f4c8fa073acaa393e9465 to your computer and use it in GitHub Desktop.
// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_VC0706.h>
// This #include statement was automatically added by the Particle IDE.
#include <ParticleSoftSerial.h>
SerialLogHandler logHandler;
// Sofware Serial connection No Camera :(
NewSoftSerial cameraconnection = NewSoftSerial(WKP, A2);
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);
// Hardware Serial connection WORKS!
// #define cameraconnection Serial1
// Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);
void setup() {
Serial.begin(9600);
delay(1000);
Log.info("----------------- BEGIN ----------------- ");
waitFor(Time.isValid, 30000);
// Try to locate the camera
if (!cam.begin()) {
Log.info("No camera found?");
} else {
Log.info("Camera Found:");
// Print out the camera version information (optional)
char *reply = cam.getVersion();
if (reply == 0) {
Serial.print("Failed to get version");
} else {
Log.info("-----------------");
Serial.print(reply);
Log.info("-----------------");
}
// Set the picture size - you can choose one of 640x480, 320x240 or 160x120
// Remember that bigger pictures take longer to transmit!
cam.setImageSize(VC0706_640x480); // biggest
// cam.setImageSize(VC0706_320x240); // medium
//cam.setImageSize(VC0706_160x120); // small
// You can read the size back from the camera (optional, but maybe useful?)
uint8_t imgsize = cam.getImageSize();
Serial.print("Image size: ");
if (imgsize == VC0706_640x480) Log.info("640x480");
if (imgsize == VC0706_320x240) Log.info("320x240");
if (imgsize == VC0706_160x120) Log.info("160x120");
// Motion detection system can alert you when the camera 'sees' motion!
// cam.setMotionDetect(true); // turn it on
cam.setMotionDetect(false); // turn it off (default)
// You can also verify whether motion detection is active!
Serial.print("Motion detection is ");
if (cam.getMotionDetect())
Log.info("ON");
else
Log.info("OFF");
}
}
void loop() {
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment