#include <MemoryCard.h>
#include <SdFat.h>
#include <JPEGCamera.h>
#include <NewSoftSerial.h>
#include <MeetAndroid.h>
//Create an instance of the camera
JPEGCamera camera;
MeetAndroid meetAndroid;
//Create a character array to store the cameras response to commands
char response[32];
//Count is used to store the number of characters in the response string.
unsigned int count=0;
//Size will be set to the size of the jpeg image.
int size=0;
int c;
//This will keep track of the data address being read from the camera
int address=0;
//eof is a flag for the sketch to determine when the end of a file is detected
//while reading the file data from the camera.
int eof=0;
char *filePathImage = "/mduino/images/";
char val; // variable to receive data from the serial port(bluetooth)
void setup()
{
// You always need to initialise the MemoryCard library
Serial.println("Init MemoryCard...");
// This demonstrates making a directory hierarchy
Serial.println();
Serial.println("Make directory...");
MemoryCard.makeDir(filePathImage);
// You can check for the existence of specific files/directories
char *filePathImage = "/mduino/images/";
Serial.println();
Serial.print(filePathImage);
Serial.print(" does ");
if (MemoryCard.exists(filePathImage)) {
Serial.println("exist.");
} else {
Serial.println("not exist.");
}
//Setup the camera, serial port and memory card
camera.begin();
Serial.begin(57600);
}
void loop()
{
if(Serial.available())
{
val = Serial.read();
switch(val)
{
case 'a':
Serial.println("Take a picture!");
MemoryCard.begin();
//Reset the camera
count=camera.reset(response);
delay(3000);
//Set Image size
Serial.println("Set Image Size ");
camera.setImageSize160x120(response);
camera.setImageSize320x240(response);
count = camera.setImageSize640x480(response);
Serial.write((const uint8_t*)response, count);
Serial.print(" Image Size =");
Serial.println(count);
delay(200);
//Reset the camera
count=camera.reset(response);
delay(3000);
//Take a picture
count=camera.takePicture(response);
//Print the response to the 'TAKE_PICTURE' command.
Serial.write((const uint8_t*)response, count);
Serial.println();
Serial.println("takePicture done! ");
//Get the size of the picture
count = camera.getSize(response, &size);
//Print the size
Serial.print("size=");
Serial.print(size);
//Create a file called 'test.txt' on the SD card.
//NOTE: The memoryCard libary can only create text files.
//The file has to be renamed to .jpg when copied to a computer.
MemoryCard.open("/image2.txt", true);
//Starting at address 0, keep reading data until we've read 'size' data.
while(address < size)
{
//Read the data starting at the current address.
count=camera.readData(response, address);
//Store all of the data that we read to the SD card
for(int i=0; i<count; i++){
//Check the response for the eof indicator (0xFF, 0xD9). If we find it, set the eof flag
if((response == (char)0xD9) && (response[i-1]==(char)0xFF))eof=1;
//Save the data to the SD card
MemoryCard.file.print(response, BYTE);
Serial.print(response);
//If we found the eof character, get out of this loop and stop reading data
if(eof==1)break;
}
//Increment the current address by the number of bytes we read
address+=count;
//Make sure we stop reading data if the eof flag is set.
if(eof==1)break;
}
MemoryCard.close();
MemoryCard.open("/image2.txt");
// // This approach is more compact
while((c = MemoryCard.file.read()) >= 0)
{
messageChar(1, c);
}
//Close the file
MemoryCard.close();
count = camera.stopPictures(response);
Serial.println("Done!");
break;
case 'f':
Serial.println("forward");
break;
default:
break;
}
}
}
Well, it seems to be using a MeetAndroid library and creates an instance of class MeetAndroid (presumably defined in that library) but doesn't do anything with the object other than instantiate it. So if there is a connection, I would guess that is where it is implemented. But I wouldn't assume there is a connection since the sketch does not appear to do anything with the object.
Well, if my assumptions are correct the meetAndroid would connect you to the Android device.
You might want to check out http://www.amarino-toolkit.net/index.php/tutorials.html for tutorials on how to pair with your bluetooth module. The first tutorial is the First connection and Test Event Tutorial.