Go Down

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

roja_winrox

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.

roja_winrox


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.

Go Up