Go Down

Topic: C328 Serial Camera Library (Read 2671 times) previous topic - next topic

Jan 07, 2013, 03:48 pm Last Edit: Jan 07, 2013, 03:54 pm by roja_winrox Reason: 1
Need help folks!, how can i make C328 Serial Camera Library work on Arduino IDE 1.0.3?  

here are the errors:
Code: [Select]

C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:24:22: error: WProgram.h: No such file or directory
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:25:24: error: WConstants.h: No such file or directory
In file included from jan4.ino:1:
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:120: error: expected `)' before '&' token
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:128: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:130: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:133: error: ISO C++ forbids declaration of 'SerialBase' with no type
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:133: error: expected ';' before '*' token
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:135: error: 'byte' does not name a type
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:136: error: 'byte' does not name a type
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:137: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:137: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:137: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:137: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:137: error: ISO C++ forbids declaration of 'byte' with no type
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:139: error: 'byte' has not been declared
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:142: error: ISO C++ forbids declaration of 'byte' with no type
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:143: error: ISO C++ forbids declaration of 'byte' with no type


but after changing the line

Code: [Select]
#include "WProgram.h" into
Code: [Select]
#include "Arduino.h"

here are the errors

Code: [Select]
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:25:24: error: WConstants.h: No such file or directory
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:120: error: expected `)' before '&' token
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:133: error: ISO C++ forbids declaration of 'SerialBase' with no type
C:\arduino projects\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:133: error: expected ';' before '*' token


please see attached files for the library i've used, please help..thanks!

PaulS

Remove WConstants.h. The contents are now part of Arduino.h.

Change NewSoftSerial to SoftwareSerial everywhere.


Remove WConstants.h. The contents are now part of Arduino.h.

Change NewSoftSerial to SoftwareSerial everywhere.


thanks PaulS for your response!, I already remove the WConstants.h..
but can't find any NewSofSerial on CameraC328r.cpp and CameraC328r.H ?

PaulS

Quote
but can't find any NewSofSerial on CameraC328r.cpp and CameraC328r.H ?

Perhaps you should try NewSoftSerial, then:
Code: [Select]
class NewSoftSerial;
CameraC328R(NewSoftSerial *softSerial = NULL);
NewSoftSerial *_serialPort;
#include <NewSoftSerial.h>
CameraC328R::CameraC328R(NewSoftSerial *softSerial)


rovelle

#4
Jan 17, 2013, 11:53 am Last Edit: Jan 18, 2013, 12:20 am by Coding Badly Reason: 1
this is also my problem in c328..i will post the code...

Code: [Select]
#include <SoftwareSerial.h>

#include <CameraC328R.h>
#define LED_PIN 13
#define PAGE_SIZE 64
#define USB_BAUD 115200
#define CAMERA_BAUD 14400
SoftwareSerial mySerial(2 , 3);
CameraC328R camera(mySerial);
uint16_t pictureSizeCount = 0;
/**
* This callback is called EVERY time a JPEG data packet is received.
*/
void getJPEGPicture_callback( uint16_t pictureSize, uint16_t packageSize,
uint16_t packageCount, byte* package )
{
// packageSize is the size of the picture part of the package
pictureSizeCount += packageSize;
Serial.write(package,packageSize);
if( pictureSizeCount >= pictureSize )
{
digitalWrite( LED_PIN, LOW );
Serial.flush();
}
}
void setup()
{
Serial.begin( USB_BAUD );
mySerial.begin(CAMERA_BAUD);
pinMode( LED_PIN, OUTPUT );
digitalWrite( LED_PIN, LOW );
}
void loop()
{
if( Serial.available() ){
while(Serial.read() != -1);
digitalWrite( LED_PIN, HIGH );
if( !camera.sync() )
{Serial.println( "Sync failed." );
return ;
}
if( !camera.initial( CameraC328R::CT_JPEG, CameraC328R::PR_160x120,
CameraC328R::JR_640x480 ) )
{
Serial.println( "Initial failed." );
return ;
}
if( !camera.setPackageSize( 64 ) )
{
Serial.println( "Package size failed." );
return ;
}
if( !camera.setLightFrequency( CameraC328R::FT_50Hz ) )
{
Serial.println( "Light frequency failed." );
return ;
}
if( !camera.snapshot( CameraC328R::ST_COMPRESSED, 0 ) )
{
Serial.println( "Snapshot failed." );
return ;
}
pictureSizeCount = 0;
if( !camera.getJPEGPicture( CameraC328R::PT_JPEG, PROCESS_DELAY,
&getJPEGPicture_callback ) )
{
Serial.println( "Get JPEG failed." );
return ;
}
}
}



Moderator edit: [code] [/code] tags added.

rovelle

please help me..i really need to correct this code.... :~

PaulS

Quote
please help me..i really need to correct this code....

One punctuation mark is sufficient.

What is wrong with the code? Why do you think it needs fixing.

We've hired a psychic, but Andre's start date is the 12th of never. If you need help before then, you need to define what help it is you need.

rovelle

i use the arduino 1.0.3...so why is it there is error if the code is correct...

here is the error...

In file included from serial_cam.ino:3:
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:26:20: error: wiring.h: No such file or directory
In file included from serial_cam.ino:3:
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:136: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:142: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:148: error: 'byte' does not name a type
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:149: error: 'byte' does not name a type
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:150: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:150: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:150: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:150: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:150: error: ISO C++ forbids declaration of 'byte' with no type
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:152: error: 'byte' has not been declared
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:155: error: ISO C++ forbids declaration of 'byte' with no type
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:156: error: ISO C++ forbids declaration of 'byte' with no type
serial_cam.ino: In function 'void loop()':
serial_cam:65: error: invalid conversion from 'void (*)(uint16_t, uint16_t, uint16_t, byte*)' to 'void (*)(uint16_t, uint16_t, uint16_t, int*)'
serial_cam:65: error: initializing argument 3 of 'bool CameraC328R::getJPEGPicture(CameraC328R::PictureType, uint16_t, void (*)(uint16_t, uint16_t, uint16_t, int*))'

i really need to correct this code..please help me! =(

PaulS

Quote
so why is it there is error if the code is correct...

Well, clearly the code is NOT correct. One punctuation mark is enough. More than that pisses people off. You want help, it's a good idea not to piss people off.

Quote
D:\arduino-1.0.3-windows\arduino-1.0.3\libraries\CameraC328R/CameraC328R.h:26:20: error: wiring.h: No such file or directory

Do you have a wiring board? Are you using the Wiring IDE? I didn't think so. So, the library is not really intended for an Arduino.

You could, of course, change wiring.h to Arduino.h to get rid of that message. And, doing that will get rid of more of the messages.

rovelle

I'm sorry because i am only a newbie in arduino..and i am studying it yet..sorry for my english...could you please help to correct this code?

PaulS

Quote
could you please help to correct this code?

Maybe after you learn to use punctuation correctly.

Coding Badly


The code is almost verbatim from here... http://arduino.cc/forum/index.php/topic,123829.msg931454.html#msg931454

The solution to the compilation errors are very likely here... http://arduino.cc/forum/index.php/topic,123829.msg931546.html#msg931546

mutugu

Dear all,

I have been searched this library but now i only found this link;
http://arms22.googlecode.com/files/CameraC328R.zip
Codes written in 2009 and now this library did not work on with my camera.
I also need this library, if anybody knows up-to-date files and shares it, i will be grateful.

Go Up