Forum: Mikrocontroller und Digitale Elektronik Fehler beim kompilieren mit Libaries (Arduino)


von Steffen (Gast)


Angehängte Dateien:

Lesenswert?

Hallo,
Ich habe ein sehr großes Problem:

Ich habe alle Beispielcodes von der Libariy IRremote ausprobiert und ich 
bekam immer eine Fehlermeldung !

Ich bin halb am verzeifeln und weiß nicht weiter, habt ihr Ideen was ich 
da machen kann ?

LG Steffen

von Karl H. (kbuchegg)


Lesenswert?

Sieht aus, als ob da ein Haufen #include Files fehlen

C:\Users\Steffen\Documents\Arduino\libraries\IRremote\/IRremoteInt.h:

Ergänze da mal
#include <stdint.h>




C:\Users\Steffen\Documents\Arduino\libraries\IRremote\IRremote.cpp:173: 
error: 'delayMicroseconds' was not declared in this scope

Welchen Header brauchst du, um die Funktion delayMicroseconds zur 
Verfügung zu haben? Include diesen Header.

Same procedure für die restlichen 'not declared in this scope" Fehler.
Korrigiere einen Fehler nach dem anderen und compiliere jeweils neu. Die 
Chancen stehen gut, dass die Fehlerliste ganz schnell schrumpft.


> Ich bin halb am verzeifeln
Keine Panik. Das ist alles halb so schlimm.

von asdfghj (Gast)


Lesenswert?

Da fehlen offensichtlich ein paar includes. Zeig mal deinen Code.

von Steffen (Gast)


Lesenswert?

Hallo,

Das ist der originale code von der libary:



1
/*
2
 * IRremote: IRrecvDump - dump details of IR codes with IRrecv
3
 * An IR detector/demodulator must be connected to the input RECV_PIN.
4
 * Version 0.1 July, 2009
5
 * Copyright 2009 Ken Shirriff
6
 * http://arcfn.com
7
 */
8
9
#include <IRremote.h>
10
11
int RECV_PIN = 11;
12
13
IRrecv irrecv(RECV_PIN);
14
15
decode_results results;
16
17
void setup()
18
{
19
  Serial.begin(9600);
20
  irrecv.enableIRIn(); // Start the receiver
21
}
22
23
// Dumps out the decode_results structure.
24
// Call this after IRrecv::decode()
25
// void * to work around compiler issue
26
//void dump(void *v) {
27
//  decode_results *results = (decode_results *)v
28
void dump(decode_results *results) {
29
  int count = results->rawlen;
30
  if (results->decode_type == UNKNOWN) {
31
    Serial.println("Could not decode message");
32
  } 
33
  else {
34
    if (results->decode_type == NEC) {
35
      Serial.print("Decoded NEC: ");
36
    } 
37
    else if (results->decode_type == SONY) {
38
      Serial.print("Decoded SONY: ");
39
    } 
40
    else if (results->decode_type == RC5) {
41
      Serial.print("Decoded RC5: ");
42
    } 
43
    else if (results->decode_type == RC6) {
44
      Serial.print("Decoded RC6: ");
45
    }
46
    Serial.print(results->value, HEX);
47
    Serial.print(" (");
48
    Serial.print(results->bits, DEC);
49
    Serial.println(" bits)");
50
  }
51
  Serial.print("Raw (");
52
  Serial.print(count, DEC);
53
  Serial.print("): ");
54
55
  for (int i = 0; i < count; i++) {
56
    if ((i % 2) == 1) {
57
      Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
58
    } 
59
    else {
60
      Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
61
    }
62
    Serial.print(" ");
63
  }
64
  Serial.println("");
65
}
66
67
68
void loop() {
69
  if (irrecv.decode(&results)) {
70
    Serial.println(results.value, HEX);
71
    dump(&results);
72
    irrecv.resume(); // Receive the next value
73
  }
74
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.