From 3e6015bce021a2fad33525ff4485d8e08eba3ba1 Mon Sep 17 00:00:00 2001 From: Chad Hendry Date: Sat, 20 Sep 2014 16:03:26 -0500 Subject: [PATCH] adding an example --- lib/LSY201/examples/TakePicture/TakePicture.ino | 1 + src/sketch.ino | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 120000 lib/LSY201/examples/TakePicture/TakePicture.ino diff --git a/lib/LSY201/examples/TakePicture/TakePicture.ino b/lib/LSY201/examples/TakePicture/TakePicture.ino new file mode 120000 index 0000000..c7d0e6b --- /dev/null +++ b/lib/LSY201/examples/TakePicture/TakePicture.ino @@ -0,0 +1 @@ +../../../../src/sketch.ino \ No newline at end of file diff --git a/src/sketch.ino b/src/sketch.ino index 2014a16..af52f63 100644 --- a/src/sketch.ino +++ b/src/sketch.ino @@ -2,7 +2,10 @@ #include #include +/* assuming the TX and RX pins on the camera are attached to pins 2 and 3 of + * the arduino. */ SoftwareSerial camera_serial(2, 3); + LSY201 camera; uint8_t buf[32]; @@ -14,16 +17,23 @@ void setup() void loop() { - camera.reset(); + Serial.println("Taking picture..."); camera.takePicture(); + Serial.println("Bytes:"); + uint16_t offset = 0; while (camera.readJpegFileContent(offset, buf, sizeof(buf))) { for (int i = 0; i < sizeof(buf); i ++) - Serial.write(buf[i]); + Serial.println(buf[i], HEX); offset += sizeof(buf); } + + Serial.println("Done."); + + camera.stopTakingPictures(); + delay(10000); }