Working usb shield canon eos example

hello,

i am looking for some help with my usb shield.
I found some great examples on GitHub - felis/Arduino_Camera_Control: PTP, Camera-specific layers to work with Arduino USB Host Shield
But none of them i can get to work.
I think do something wrong...
I dowloaded the zip and placed it in my arduino folder
The examples show up in the program but when i try to compile them the errors are great!
I will post some errors below...
And the only thing that i would like to do is read the filename for the camera
So if someone can help me with that i pay his beer and the next one too :wink:

The errors...

In file included from /Users/user/Documents/Arduino/libraries/Camera/ptp.h:28,
                 from EOSEventMonitor.cpp:10:
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h:22:22: error: WProgram.h: No such file or directory
In file included from /Users/user/Documents/Arduino/libraries/Camera/ptp.h:28,
                 from EOSEventMonitor.cpp:10:
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h: In constructor 'MultiByteValueParser::MultiByteValueParser()':
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h:44: error: 'NULL' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h: In constructor 'ByteSkipper::ByteSkipper()':
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h:64: error: 'NULL' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h: At global scope:
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h:147: error: 'NULL' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h: In constructor 'PTPListParser::PTPListParser()':
/Users/user/Documents/Arduino/libraries/Camera/ptpcallback.h:116: error: 'NULL' was not declared in this scope
In file included from /Users/user/Documents/Arduino/libraries/Camera/ptp.h:29,
                 from EOSEventMonitor.cpp:10:
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h: In function 'void PrintHex(T)':
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:35: error: 'Serial' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:39: error: 'Serial' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:39: error: 'HEX' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h: At global scope:
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:43: error: variable or field 'PrintHex2' declared void
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:43: error: 'Print' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:43: error: 'prn' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptpdebug.h:43: error: expected primary-expression before 'val'
In file included from EOSEventMonitor.cpp:10:
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:77: error: 'MAX3421E' does not name a type
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:78: error: 'USB' does not name a type
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:86: error: 'EP_RECORD' does not name a type
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:116: error: ISO C++ forbids declaration of 'MAX3421E' with no type
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:116: error: expected ';' before '*' token
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:117: error: ISO C++ forbids declaration of 'USB' with no type
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:117: error: expected ';' before '*' token
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:171: error: 'byte' has not been declared
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:171: error: 'byte' has not been declared
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:128: error: 'NULL' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/ptp.h: In member function 'void PTP::Setup()':
/Users/user/Documents/Arduino/libraries/Camera/ptp.h:124: error: 'Max' was not declared in this scope
In file included from EOSEventMonitor.cpp:13:
/Users/user/Documents/Arduino/libraries/Camera/simpletimer.h: In constructor 'SimpleTimer::SimpleTimer()':
/Users/user/Documents/Arduino/libraries/Camera/simpletimer.h:47: error: 'NULL' was not declared in this scope
/Users/user/Documents/Arduino/libraries/Camera/simpletimer.h: In member function 'uint32_t SimpleTimer::TimeLeft()':
/Users/user/Documents/Arduino/libraries/Camera/simpletimer.h:64: error: 'millis' was not declared in this scope

http://arduino.cc/forum/index.php/topic,97455.0.html

Number 2.

Hi ,

Thanks for your suggestion
But if it was this simple i should have found it all ready after some days...
Unfortunatly it is not the solution

but thanks again...

For example the code i want to try to use is this one

#include <inttypes.h>
#include <avr/pgmspace.h>

//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>

#include <ptp.h>
#include <ptpdebug.h>
#include <canoneos.h>
#include <simpletimer.h>

#define DEV_ADDR        1

// Canon EOS 400D
#define DATA_IN_EP      1
#define DATA_OUT_EP     2
#define INTERRUPT_EP    3
#define CONFIG_NUM      1

class CamStateHandlers : public EOSStateHandlers
{
      enum CamStates { stInitial, stDisconnected, stConnected };
      CamStates stateConnected;
    
public:
      CamStateHandlers() : stateConnected(stInitial) 
      {
      };
      
      virtual void OnDeviceDisconnectedState(PTP *ptp);
      virtual void OnDeviceInitializedState(PTP *ptp);
};

CamStateHandlers   CamStates;
SimpleTimer        PTPPollTimer;
CanonEOS           Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);


void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
    if (stateConnected == stConnected || stateConnected == stInitial)
    {
        stateConnected = stDisconnected;
        PTPPollTimer.Disable();
        Notify(PSTR("\r\nDevice disconnected.\r\n"));
    }
}

void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
    if (stateConnected == stDisconnected)
    {
        stateConnected = stConnected;
        PTPPollTimer.Enable();
    }
}

void OnPTPPollTimer()
{
    Serial.println("\r\n");
    
    HexDump  hex;
    Eos.EventCheck(&hex);
}

void setup() 
{
    Serial.begin( 115200 );
    Serial.println("Start");
    Eos.Setup();
    delay( 200 );
    PTPPollTimer.Set(OnPTPPollTimer, 1000);
}

void loop() 
{
    Eos.Task();
    PTPPollTimer.Run();
}

rogierv:
Hi ,

Thanks for your suggestion
But if it was this simple i should have found it all ready after some days...
Unfortunatly it is not the solution

But it tells you what the problem is. The problem is that the library was created for an older version of the Arduino IDE. So you have three choices:

Update the IDE. The link gives you a place to get started, but it might not be that simple.
Find an updated version of the library that is intended for the version of the IDE you are using.
Use an older version of the IDE.

Ok thanks...

i am going to search now for older IDE

With the 0.23 build it is giving errors too.

Can somebody confirm that it should be working?
Or has somebody been able to compile without errors?

I found out that the problems come from ptp.h
When i uncomment all it goes wrong with this one...

hope to find out now...
help is still welcome!

I found out that the problems come from ptp.h

But, you're not going to tell us what the problems are, or what version of the IDE you are getting them on.

help is still welcome!

I'm sure it would be. Whack yourself with a clue-by-four first, though...

But, you're not going to tell us what the problems are, or what version of the IDE you are getting them on.

I wish i found out what the problem is
for now i only know that the errors show up when i include this one

I'm sure it would be. Whack yourself with a clue-by-four first, though...

Sorry i do not understand what you mean with this, but i conclude that you are not going to help and i need to do it my self...

for now i only know that the errors show up when i include this one

What errors? What version of the IDE are you now using?

but i conclude that you are not going to help

I can't, until you define what it is you need help with.

i need to do it my self...

Unless you get a clue, and post some code, some error messages, and answer some questions.

The code is all the code that van be found on the web
and it is a huge zip with files and i didnt know were to begin.

but...

with thanks to Oleg i finally found the problem...
and the problem was that i did not install the usb library :* :* :*

so now it is working and it did not has to do nothing with the ptp.h
it even works on IDE1.0

but thanks anyway!