-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCameraMod.cpp
42 lines (34 loc) · 1.43 KB
/
CameraMod.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
Author: Zach Richard
Date: 05/19/2014
Project: Trap Sat: Capitol College
This library will be used to take and store pictures using the Arduino YUN and a USB webcam.
*/
#include "CameraMod.h"
#include "Bridge.h"
CameraMod::CameraMod() // Constructor
{
filename = "newPicture.png"; // Will be changed to the current dateTime of
location = "/mnt/sda1/"; // Root of the sdcard
}
void CameraMod::SetName(String n) // used to set the name of the picture
{
filename = n + ".png";
}
void CameraMod::SetDir(String dir) // used to set the directory where the file should be stored
{
//if (!FileSystem.exists(dir)) // ignore these two lines for now.
///FileSystem.mkdir(); // they only accept const char array pointers, not strings for whatever reason.
location = location + dir + "/"; // since location is already set to the root of the SD, this is really meant to add a folder,
// or multiple folders to the directory path
}
void CameraMod::TakePic()
{
pic.begin("fswebcam"); // Uses the fswebcam command
pic.addParameter(location + filename); // Adds a paramater to fswebcam. This is the full directory path where the file will be saved.
pic.run(); // Actually runs the pic process on the Linux processor. !!!This command will halt the program until complete!!!
}
String CameraMod::GetPic()// Will return the full directory path, including the name of the file
{
return location + filename;
}