Pages: [1]   Go Down
Author Topic: Trouble with Radio Shack's JPEG Color Camera Board  (Read 1351 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys, Perhaps I'm a bit in over my head. I got the LED example to blink but I'm not sure how everything actually works (as I understood it, you write a sketch or library of sketches, verify to see if it works, then upload to your micro controller, which then should execute whatever you wrote) Currently I bought the Arduino starter kit, arduino wireless SD and Radio Shack's JPEG Color Camera Board. my goal is to create a security cam that takes pictures upon motion. When I verified the radio shack code it gave me several errors smiley-sad which I don't understand nor know how to fix (My understanding of C++ is almost non-existent) I would rather be taught than told what the right answer is if anyone could help me I would appreciate it. Thank you
#include <avr/pgmspace.h>
#include "Arduino.h"


/*
 * The following code includes all necessary routines to control Camera Shield
 *
 * In addition, we have prepared a example for making surveillance camera by putting Camera shield (RS SKU 2760248) and SD Card shield (RS SKU 2760243) together.
 * 1) Install SD Card shield properly and download all necessary FAT drivers from shield providers
 * 2) Install Camera shield properly
 * 3) Enable "#define sdCamera 1" to enable the demo code
 * 4) With the built-in motion detection function, camera shield will capture image and store to SD card automatically .
 *
 */

#define sdCamera 1   // ***** Enable it for Surveillance Camera demonstration *****

#ifdef sdCamera
#include <Sd2Card.h>   // ***** SD card driver from http://www.seeedstudio.com/wiki/SD_Card_Shield or SD card shield supplier *****
#include <SdFat.h>   // ***** FAT file system from http://www.seeedstudio.com/wiki/SD_Card_Shield or SD card shield supplier *****
#endif



/*
 * SD chip select pin.  Common values are:
 *
 * Arduino Ethernet shield, pin 4.
 * SparkFun SD shield, pin 8.
 * Adafruit SD shields and modules, pin 10.
 * Default SD chip select is the SPI SS pin.
 */
 
#ifdef sdCamera
const uint8_t SdChipSelect = SS;
SdFat sd;
Sd2Card card;
SdFile myFile;
#endif

#define NORMAL_USE   1

#define VC0706_PROTOCOL_SIGN          0x56
#define VC0706_SERIAL_NUMBER          0x00

#define VC0706_COMMAND_RESET         0x26
#define VC0706_COMMAND_GEN_VERSION      0x11
#define VC0706_COMMAND_TV_OUT_CTRL      0x44
#define VC0706_COMMAND_OSD_ADD_CHAR      0x45
#define VC0706_COMMAND_DOWNSIZE_SIZE      0x53
#define VC0706_COMMAND_READ_FBUF      0x32
#define FBUF_CURRENT_FRAME         0
#define FBUF_NEXT_FRAME            0

#define VC0706_COMMAND_FBUF_CTRL      0x36
#define VC0706_COMMAND_COMM_MOTION_CTRL      0x37
#define VC0706_COMMAND_COMM_MOTION_DETECTED   0x39
#define VC0706_COMMAND_POWER_SAVE_CTRL      0x3E
#define VC0706_COMMAND_COLOR_CTRL      0x3C
#define VC0706_COMMAND_MOTION_CTRL      0x42


#define VC0706_COMMAND_WRITE_DATA      0x31
#define VC0706_COMMAND_GET_FBUF_LEN      0x34

#define READ_DATA_BLOCK_NO         56




unsigned char    tx_counter;
unsigned char    tx_vcbuffer[20];
bool      tx_ready;

bool      rx_ready;
unsigned char    rx_counter;
unsigned char    VC0706_rx_buffer[80];

uint32_t    frame_length=0;

uint32_t    vc_frame_address =0;

uint32_t    last_data_length=0;


//------------------------------------------------------------------------------
void buffer_send();



// ***********************************************************************************************************
// *
// *                            Power Up Init.
// *
// *
// ***********************************************************************************************************
void setup()
{

#ifdef NORMAL_USE

#ifdef sdCamera
     // Initialize SdFat or print a detailed error message and halt
     // Use half speed like the native library.
   if (!sd.begin(SdChipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();

   
   Serial.begin(115200);

   capture_photo();
   
   delay(100);

   VC0706_frame_control(3);
   delay(10);
   
   //motion windows setting
   VC0706_motion_windows_setting(0x1a5a,0x5000);
   delay(10);
   VC0706_motion_windows_setting(0x1a5e,0x0a000f000);
   delay(10);
   VC0706_motion_windows_setting(0x1a62,0x3f010000);
   delay(10);
   VC0706_motion_windows_setting(0x1a66,0x3c007800);
   delay(10);
   VC0706_motion_windows_setting(0x1a6a,0x0b400ef00);
   delay(10);
      
   //start motion monitoring
   VC0706_motion_control(1);
   delay(10);
   VC0706_motion_detection(1);
   delay(10);
   Serial.end();         // clear all rx buffer
   delay(5);
   Serial.begin(115200);
   rx_ready=false;
#endif

   
#else
#endif
}





// ***********************************************************************************************************
// *
// *                            Main Loop
// *
// *
// ***********************************************************************************************************
void loop()
{
#ifdef sdCamera
   buffer_read();
   
   if(rx_ready){
      rx_ready=false;
      if (VC0706_rx_buffer[2]!=VC0706_COMMAND_COMM_MOTION_DETECTED) return;
      if (VC0706_rx_buffer[3]!=0x00) return;
      
   //stop motion detection for capture photo
      VC0706_motion_control(0);
      delay(10);
      VC0706_motion_detection(0);
      delay(1000);
      
   // capture current photo 1s later
      capture_photo();
      delay(100);

      VC0706_frame_control(3);   // resume AV out
      delay(10);
   
   //prepare next motion monitoring
      VC0706_motion_control(1);
      delay(10);
      VC0706_motion_detection(1);
      delay(10);
      Serial.end();         // clear all rx buffer
      delay(5);
      Serial.begin(115200);
      rx_ready=false;
      return;
      
      };
#endif   
   
   delay(300);

}







/*******************************************************************************
 * Function Name  : VC0706_reset
 * Description    : Reset VC0706
 *                  
 * Input          : None
 *                  
 * Output         : None
 * Return         : None
 *******************************************************************************/
void VC0706_reset()
{
   tx_vcbuffer[0]=VC0706_PROTOCOL_SIGN;
   tx_vcbuffer[1]=VC0706_SERIAL_NUMBER;
   tx_vcbuffer[2]=VC0706_COMMAND_RESET;
   tx_vcbuffer[3]=0x00;
   
   tx_counter=4;

   buffer_send();
}



/*******************************************************************************
 * Function Name  : VC0706_get_version
 * Description    : Request version string from VC0706
 *                  
 * Input          : None
 *                  
 * Output         : None
 * Return         : None
 *******************************************************************************/
void VC0706_get_version()
{
   tx_vcbuffer[0]=VC0706_PROTOCOL_SIGN;
   tx_vcbuffer[1]=VC0706_SERIAL_NUMBER;
   tx_vcbuffer[2]=VC0706_COMMAND_GEN_VERSION;
   tx_vcbuffer[3]=0x00;
   
   tx_counter=4;

   buffer_send();
}


/*******************************************************************************
 * Function Name  : VC0706_tv_out_control
 * Description    : stop or start TV output from VC0706
 *                  
 * Input          : on=0 stop tv output
 ;         :  on=1 start tv output
 *                  
 * Output         : None
 * Return         : None
 *******************************************************************************/
void VC0706_tv_out_control(int on)
{
   tx_vcbuffer[0]=VC0706_PROTOCOL_SIGN;
   tx_vcbuffer[1]=VC0706_SERIAL_NUMBER;
   tx_vcbuffer[2]=VC0706_COMMAND_TV_OUT_CTRL;
   tx_vcbuffer[3]=0x01;
   tx_vcbuffer[4]=on;
   tx_counter=5;

   buffer_send();
}

/*******************************************************************************
 * Function Name  : VC0706_osd_add_char
 * Description    : ADD OSD CHARACTERS TO CHANNELS(CHANNEL 1)
 *                  
 * Input          : col : Display column
 *   `        row: Display Row
 *           osd_string : display string (max 14 characters)
 *                  
 * Output         : None
 * Return         : None
 *******************************************************************************/
void VC0706_osd_add_char(int col, int row, String osd_string)
{
   unsigned char col_row;
   int string_length;
   int i;
   
   col&=0x0f;
   row&=0x0f;
   col_row=(unsigned char)(col<<4 | row);

   string_length=osd_string.length();
   if (string_length>14)
      string_length=14;      // max 14 osd characters
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 46000
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You obviously didn't bother reading the sticky at the top of the forum:
http://forum.arduino.cc/index.php?topic=97455.0

Quote
When I verified the radio shack code it gave me several errors
And they are?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

camera:51: error: 'SdFat' does not name a type
camera:52: error: 'Sd2Card' does not name a type
camera:53: error: 'SdFile' does not name a type
camera.ino: In function 'void setup()':
camera:120: error: 'sd' was not declared in this scope
camera:120: error: 'SPI_HALF_SPEED' was not declared in this scope
camera.ino: In function 'void capture_photo()':
camera:715: error: 'sd' was not declared in this scope
camera:718: error: 'myFile' was not declared in this scope
camera:718: error: 'O_RDWR' was not declared in this scope
camera:718: error: 'O_CREAT' was not declared in this scope
camera:718: error: 'O_AT_END' was not declared in this scope
camera:719: error: 'sd' was not declared in this scope
camera:723: error: 'myFile' was not declared in this scope
camera:755: error: 'O_RDWR' was not declared in this scope

It won't let me post the whole code I'm having to cut it into pieces
« Last Edit: July 07, 2013, 09:49:38 am by CrustyDave » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 46000
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
camera:51: error: 'SdFat' does not name a type
One of the dumbest decisions made by the Arduino team was to suppress the normally fatal error when an include file can not be found. Instead, you get seemingly cryptic messages like this.

It appears that you have not downloaded or correctly installed the SdFat library.
Logged

Pages: [1]   Go Up
Jump to: