mehrere Bibliotheken verschachtelt - Variable wird nicht erkannt

Hallo ihr Arduino-Wissenden!

Könnt ihr bitte einem blutigen Anfänger eine Tipp geben; und zwar: Ich möchte meine Canon EOS 550D via Fernsteuerung bedienen.

Habe mich - da es mein Arduino Erstlingswerk ist in kleinen Schritten heran getastet.

So weit, so gut. Die Einzelteile funktionieren nun also - jetzt geht’s an zusammenfügen. Und genau dort ist mein Problem. Oder besser gesagt das Problem des Compilers, der da meldet:

ARemote_0_90.ino: In member function ‘virtual void CamStateHandlers::OnDeviceInitializedState(PTP*)’:
ARemote_0_90:59: error: base operand of ‘->’ has non-pointer type ‘decode_results’
ARemote_0_90:60: error: base operand of ‘->’ has non-pointer type ‘decode_results’
ARemote_0_90:68: error: expected primary-expression before ‘}’ token
ARemote_0_90:68: error: expected `;’ before ‘}’ token

Der Code ist anbei - bitte werft doch mal eine Blick drauf was da faul daran ist.

thx - lG
Gerhard

WL-85.jpg

ARemote_0_90.ino (1.84 KB)

Der Code kompiliert richtig wenn Du "->" durch "." ersetzt und wenn Du default: löschst. Frag mich aber nicht, ob dann der Code funktioniert. So gut kann ich C++ dann auch wieder nicht. Aus Mangel an der Kamera und Fernsteuerung kann ich das auch nicht kontrollieren. Grüße Uwe

Danke Uwe!

habe Deine Änderungen durchgeführt und bekomme jetzt folgendes Ergebnis:

// INCLUDES
#include <canoneos.h>
#include <usbhub.h>
#include <IRremote.h>

// SET (grundstellungen für den IR Sensor)
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;

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;
USB        Usb;
USBHub     Hub1(&Usb);
CanonEOS   Eos(&Usb, &CamStates);

// MAIN-SETUP
void setup() {
  Serial.begin( 9600 );
  Serial.println("Start");
  irrecv.enableIRIn(); // Start the receiver
  if (Usb.Init() == -1)
    Serial.println("OSC did not start.");
  delay(1000);
  TCNT2 = 128;
  TCCR2A = 0;
  TCCR2B = (1<<CS22);
  TIMSK2 |= (1<<TOIE2);
  sei();
}

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

void CamStateHandlers::OnDeviceInitializedState(PTP *ptp) {
  if (stateConnected == stDisconnected || stateConnected == stInitial) {
    stateConnected = stConnected;
  }
  if (stateConnected == stConnected) {
    if (irrecv.decode(&results)) {    // Read IR
      Serial.println(results.value, HEX);
      if (results.decode_type == NEC) {
        switch (results.value) {
        case 2708400151:
          Serial.println("Stop");
          break;
        case 2708373631:
          Serial.println("Play");
          break;
//        default: 
        } 
      } 
    }
    irrecv.resume(); // Receive the next value
  }
}

// *****************************   MAIN-LOOP   *****************************************
void loop() {
  Usb.Task();
}

Fehler:

ARemote_0_90.cpp.o: In function `__static_initialization_and_destruction_0':
/Users/gerhard/Downloads/ARemote_0_90.ino:28: undefined reference to `CanonEOS::CanonEOS(USB*, PTPStateHandlers*)'
ARemote_0_90.cpp.o:(.rodata._ZTV16CamStateHandlers+0x6): undefined reference to `PTPStateHandlers::OnSessionNotOpenedState(PTP*)'
ARemote_0_90.cpp.o:(.rodata._ZTV16CamStateHandlers+0x8): undefined reference to `EOSStateHandlers::OnSessionOpenedState(PTP*)'
ARemote_0_90.cpp.o:(.rodata._ZTV16CamStateHandlers+0xc): undefined reference to `PTPStateHandlers::OnDeviceNotRespondingState(PTP*)'
ARemote_0_90.cpp.o:(.rodata._ZTV16CamStateHandlers+0xe): undefined reference to `PTPStateHandlers::OnDeviceBusyState(PTP*)'
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 32
	at processing.app.tools.DiscourseFormat.appendFormattedLine(DiscourseFormat.java:192)
	at processing.app.tools.DiscourseFormat.show(DiscourseFormat.java:99)
	at processing.app.Editor$34.actionPerformed(Editor.java:1169)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
	at com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:95)
	at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
	at java.awt.MenuItem.processEvent(MenuItem.java:586)
	at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:337)
	at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:325)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:683)
	at java.awt.EventQueue.access$000(EventQueue.java:86)
	at java.awt.EventQueue$1.run(EventQueue.java:639)
	at java.awt.EventQueue$1.run(EventQueue.java:637)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:653)
	at java.awt.EventQueue$2.run(EventQueue.java:651)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:650)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 32
	at processing.app.tools.DiscourseFormat.appendFormattedLine(DiscourseFormat.java:192)
	at processing.app.tools.DiscourseFormat.show(DiscourseFormat.java:99)
	at processing.app.Editor$34.actionPerformed(Editor.java:1169)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
	at com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:95)
	at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
	at java.awt.MenuItem.processEvent(MenuItem.java:586)
	at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:337)
	at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:325)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:683)
	at java.awt.EventQueue.access$000(EventQueue.java:86)
	at java.awt.EventQueue$1.run(EventQueue.java:639)
	at java.awt.EventQueue$1.run(EventQueue.java:637)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:653)
	at java.awt.EventQueue$2.run(EventQueue.java:651)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:650)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)