Different version of software

Hi, may I know if I have two differents sets of source codes running on two different software(version 1.6.9 and 1.0.5) respectively, how do I integrate it to become 1 ?

Thanks.
Ryan

Can you describe your situation in more detail? What do you mean by "sets of source code"? You mean sketches? collections of sketch + libraries + cores? What do you mean by integrate?

Do you mean that you've got a sketch that works on 1.0.5, and one that works on 1.6.9, and you want to combine them into one sketch that does both things and works with 1.6.9? Make the sketch that only works on 1.0.5 work with 1.6.9 (can't give any guidance there without the code and error output). Then combine them - there are guides with general information on combining sketches all over the place, newbies are always wanting to do that.

yes. exactly what you mentioned. combine sketch of 1.0.5 with 1.6.9. one set of sketch only works in 1.0.5 and the other one works on 1.6.9. so how do I make them both work in 1.6.9 ?

You need to post the sketches, use code tags(</> button on the toolbar). Post the full compiler error messages that you're getting when you try to compile the 1.0.5 sketch on 1.6.9(I'm assuming we don't need to worry about making the 1.6.9 sketch compatible with 1.0.5), use code tags for the compiler output also. If your sketches use any 3rd party libraries then post links to where we can download them(or state if you used Library Manager to install).

<#include <camera_VC0706.h>
#include <SD.h>
#include <SoftwareSerial.h>

#define chipSelect 10
#if ARDUINO >= 100
SoftwareSerial cameraconnection = SoftwareSerial(2, 3);
#else
NewSoftSerial cameraconnection = NewSoftSerial(2, 3);
#endif
camera_VC0706 cam = camera_VC0706(&cameraconnection);
void setup() {

#if !defined(SOFTWARE_SPI)
#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
if(chipSelect != 53) pinMode(53, OUTPUT); // SS on Mega
#else
if(chipSelect != 10) pinMode(10, OUTPUT); // SS on Uno, etc.
#endif
#endif

pinMode(7,INPUT_PULLUP);
Serial.begin(9600);
Serial.println("VC0706 Camera test");

//SD卡检测
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
return;
}

// 查询摄像头
if (cam.begin()) {
Serial.println("Camera Found:");
} else {
Serial.println("No camera found?");
return;
}
// 摄像头版本号
char *reply = cam.getVersion();
if (reply == 0) {
Serial.print("Failed to get version");
} else {
Serial.println("-----------------");
Serial.print(reply);
Serial.println("-----------------");
}

// 选择合适的图片尺寸 640x480, 320x240 or 160x120
// 图片越大,传输速度越慢
cam.setImageSize(VC0706_640x480);
//cam.setImageSize(VC0706_320x240);
//cam.setImageSize(VC0706_160x120);

uint8_t imgsize = cam.getImageSize();
Serial.print("Image size: ");
if (imgsize == VC0706_640x480) Serial.println("640x480");
if (imgsize == VC0706_320x240) Serial.println("320x240");
if (imgsize == VC0706_160x120) Serial.println("160x120");

Serial.println("Get ready !");

}

void loop() {

if(digitalRead(7)== 0) { //按键检测
delay(10);
if(digitalRead(7)== 0) {
if (! cam.takePicture())
Serial.println("Failed to snap!");
else
Serial.println("Picture taken!");
char filename[13];
strcpy(filename, "IMAGE00.JPG");
for (int i = 0; i < 100; i++) {
filename[5] = '0' + i/10;
filename[6] = '0' + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(filename)) {
break;
}
}
File imgFile = SD.open(filename, FILE_WRITE);
uint16_t jpglen = cam.frameLength();
Serial.print(jpglen, DEC);
Serial.println(" byte image");

Serial.print("Writing image to ");
Serial.print(filename);

while (jpglen > 0) {
// 一次读取32bytes
uint8_t *buffer;
uint8_t bytesToRead = min(32, jpglen); // 调节一次性读取数据大小,从32-64byte ,过大容易不工作
buffer = cam.readPicture(bytesToRead);
imgFile.write(buffer, bytesToRead);
jpglen -= bytesToRead;
}
imgFile.close();
Serial.println("...Done!");
cam.resumeVideo();
}
}
}>

This is the error message
<Arduino: 1.6.9 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:63:9: error: prototype for 'uint8_t camera_VC0706::setMotionStatus(uint8_t, uint8_t, uint8_t)' does not match any in class 'camera_VC0706'

uint8_t camera_VC0706::setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2) {

^

In file included from C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:10:0:

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.h:78:11: error: candidate is: boolean camera_VC0706::setMotionStatus(uint8_t, uint8_t, uint8_t)

boolean setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2);

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp: In member function 'void camera_VC0706::OSD(uint8_t, uint8_t, char*)':

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:151:32: warning: narrowing conversion of 'strlen(((const char*)str))' from 'size_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

uint8_t args[17] = {strlen(str), strlen(str)-1, (y & 0xF) | ((x & 0x3) << 4)};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:151:46: warning: narrowing conversion of '(strlen(((const char*)str)) + 65535u)' from 'size_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

uint8_t args[17] = {strlen(str), strlen(str)-1, (y & 0xF) | ((x & 0x3) << 4)};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:151:60: warning: narrowing conversion of '((((int)y) & 15) | ((((int)x) & 3) << 4))' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

uint8_t args[17] = {strlen(str), strlen(str)-1, (y & 0xF) | ((x & 0x3) << 4)};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp: In member function 'boolean camera_VC0706::setPTZ(uint16_t, uint16_t, uint16_t, uint16_t)':

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:185:29: warning: narrowing conversion of '(wz >> 8)' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

uint8_t args[] = {0x08, wz >> 8, wz,

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:189:19: warning: narrowing conversion of 'wz' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:186:23: warning: narrowing conversion of '(hz >> 8)' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

hz >> 8, wz,

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:189:19: warning: narrowing conversion of 'wz' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:187:23: warning: narrowing conversion of '(pan >> 8)' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

pan>>8, pan,

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:189:19: warning: narrowing conversion of 'pan' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:188:24: warning: narrowing conversion of '(tilt >> 8)' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

tilt>>8, tilt

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:189:19: warning: narrowing conversion of 'tilt' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

};

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp: In member function 'uint8_t* camera_VC0706::readPicture(uint8_t)':

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:278:35: warning: narrowing conversion of '(((camera_VC0706*)this)->camera_VC0706::frameptr >> 8)' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

0, 0, frameptr >> 8, frameptr & 0xFF,

^

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:278:50: warning: narrowing conversion of '(((camera_VC0706*)this)->camera_VC0706::frameptr & 255u)' from 'uint16_t {aka unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

0, 0, frameptr >> 8, frameptr & 0xFF,

^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences>

camera_VC0706.h (3.02 KB)

camera_VC0706.cpp (8.87 KB)

You didn't use code tags like I asked you to. Take a look at the compiler output you posted. Do you see those smiley faces? That's because the forum software interpreted some of the text as forum markup. If you would have used code tags that wouldn't have happened.

RyanTWJ:
C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:63:9: error: prototype for 'uint8_t camera_VC0706::setMotionStatus(uint8_t, uint8_t, uint8_t)' does not match any in class 'camera_VC0706'

uint8_t camera_VC0706::setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2) {

^

In file included from C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:10:0:

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.h:78:11: error: candidate is: boolean camera_VC0706::setMotionStatus(uint8_t, uint8_t, uint8_t)

boolean setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2);

^

Lets break that down line by line and see if you can understand what the compiler was trying to tell you:

C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.cpp:63:9

Means the problem is in the file camera_VC0706.cpp at or around line 63, ninth character. That line is:

uint8_t camera_VC0706::setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2) {
C:\Program Files (x86)\Arduino\libraries\camera_VC0706\camera_VC0706.h:78:11: error: candidate is:

The file camera_VC0706.h contains a prototype for a function of the same name at line 78:

  boolean setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2);

Do you see a difference between the two? They are supposed to match but they have different return types.

Try change camera_VC0706.cpp line 63 from:

uint8_t camera_VC0706::setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2) {

to:

boolean camera_VC0706::setMotionStatus(uint8_t x, uint8_t d1, uint8_t d2) {

so that it matches the prototype.