Skip to content

Commit

Permalink
adding an example
Browse files Browse the repository at this point in the history
  • Loading branch information
chendry committed Sep 20, 2014
1 parent 3540e2e commit 3e6015b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/LSY201/examples/TakePicture/TakePicture.ino
14 changes: 12 additions & 2 deletions src/sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
#include <SoftwareSerial.h>
#include <LSY201.h>

/* 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];

Expand All @@ -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);
}

0 comments on commit 3e6015b

Please sign in to comment.