0

可以提供IRremote Library的函式庫(Ameba版)

http://www.pjrc.com/teensy/td_libs_IRremote.html

code here

============

#include <IRremote.h>

const int RECV_PIN = 6;

IRrecv irrecv(RECV_PIN);

decode_results results;

void <b>setup</b>()
{
  <b>Serial</b>.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  irrecv.blink13(true);
}

void <b>loop</b>() {
  if (irrecv.decode(&results)) {
    if (results.decode_type == NEC) {
      <b>Serial</b>.print("NEC: ");
    } else if (results.decode_type == SONY) {
      <b>Serial</b>.print("SONY: ");
    } else if (results.decode_type == RC5) {
      <b>Serial</b>.print("RC5: ");
    } else if (results.decode_type == RC6) {
      <b>Serial</b>.print("RC6: ");
    } else if (results.decode_type == UNKNOWN) {
      <b>Serial</b>.print("UNKNOWN: ");
    }
    <b>Serial</b>.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}

========================

compile fail and error message

WARNING: Spurious .github folder in 'Adafruit ADXL345' library
WARNING: Spurious .github folder in 'Adafruit ILI9341' library
建置選項已變更,重建所有
In file included from C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:20:0:

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:227:31: error: 'TCCR2A' was not declared in this scope

#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:227:3: note: in expansion of macro 'TIMER_ENABLE_PWM'

TIMER_ENABLE_PWM; // Enable pin 3 PWM output

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:227:45: error: 'COM2B1' was not declared in this scope

#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:227:3: note: in expansion of macro 'TIMER_ENABLE_PWM'

TIMER_ENABLE_PWM; // Enable pin 3 PWM output

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:227:51: error: '_BV' was not declared in this scope

#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:227:3: note: in expansion of macro 'TIMER_ENABLE_PWM'

TIMER_ENABLE_PWM; // Enable pin 3 PWM output

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:228:31: error: 'TCCR2A' was not declared in this scope

#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1)))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:235:3: note: in expansion of macro 'TIMER_DISABLE_PWM'

TIMER_DISABLE_PWM; // Disable pin 3 PWM output

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:228:47: error: 'COM2B1' was not declared in this scope

#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1)))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:235:3: note: in expansion of macro 'TIMER_DISABLE_PWM'

TIMER_DISABLE_PWM; // Disable pin 3 PWM output

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:228:53: error: '_BV' was not declared in this scope

#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1)))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:235:3: note: in expansion of macro 'TIMER_DISABLE_PWM'

TIMER_DISABLE_PWM; // Disable pin 3 PWM output

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:230:31: error: 'TIMSK2' was not declared in this scope

#define TIMER_DISABLE_INTR (TIMSK2 = 0)

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:253:3: note: in expansion of macro 'TIMER_DISABLE_INTR'

TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:234:3: error: 'TCCR2A' was not declared in this scope

TCCR2A = _BV(WGM20); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:234:16: error: 'WGM20' was not declared in this scope

TCCR2A = _BV(WGM20); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:234:21: error: '_BV' was not declared in this scope

TCCR2A = _BV(WGM20); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:235:3: error: 'TCCR2B' was not declared in this scope

TCCR2B = _BV(WGM22) | _BV(CS20); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:235:16: error: 'WGM22' was not declared in this scope

TCCR2B = _BV(WGM22) | _BV(CS20); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:235:29: error: 'CS20' was not declared in this scope

TCCR2B = _BV(WGM22) | _BV(CS20); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:236:3: error: 'OCR2A' was not declared in this scope

OCR2A = pwmval; \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:237:3: error: 'OCR2B' was not declared in this scope

OCR2B = pwmval / 3; \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:263:3: note: in expansion of macro 'TIMER_CONFIG_KHZ'

TIMER_CONFIG_KHZ(khz);

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:274:7: error: 'cli' was not declared in this scope

cli();

^

In file included from C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:20:0:

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:249:3: error: 'TCCR2A' was not declared in this scope

TCCR2A = _BV(WGM21); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:249:16: error: 'WGM21' was not declared in this scope

TCCR2A = _BV(WGM21); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:249:21: error: '_BV' was not declared in this scope

TCCR2A = _BV(WGM21); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:250:3: error: 'TCCR2B' was not declared in this scope

TCCR2B = _BV(CS21); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:250:16: error: 'CS21' was not declared in this scope

TCCR2B = _BV(CS21); \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:251:3: error: 'OCR2A' was not declared in this scope

OCR2A = TIMER_COUNT_TOP / 8; \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:252:3: error: 'TCNT2' was not declared in this scope

TCNT2 = 0; \

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:279:3: note: in expansion of macro 'TIMER_CONFIG_NORMAL'

TIMER_CONFIG_NORMAL();

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:229:31: error: 'TIMSK2' was not declared in this scope

#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:282:3: note: in expansion of macro 'TIMER_ENABLE_INTR'

TIMER_ENABLE_INTR;

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:229:44: error: 'OCIE2A' was not declared in this scope

#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:282:3: note: in expansion of macro 'TIMER_ENABLE_INTR'

TIMER_ENABLE_INTR;

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremoteInt.h:229:50: error: '_BV' was not declared in this scope

#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A))

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:282:3: note: in expansion of macro 'TIMER_ENABLE_INTR'

TIMER_ENABLE_INTR;

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:286:7: error: 'sei' was not declared in this scope

sei(); // enable interrupts

^

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp: At global scope:

C:\Users\user\Documents\Ameba\libraries\IRremote\IRremote.cpp:311:4: error: expected constructor, destructor, or type conversion before '(' token

ISR(TIMER_INTR_NAME)

^

"IRremote.h"找到多個程式庫
已使用: C:\Users\user\Documents\Ameba\libraries\IRremote
未使用: D:\arduino-1.6.7\libraries\RobotIRremote
exit status 1
編譯時發生錯誤

sean 回答了