正好自己diy了atmega8的arduino
用的usbasp
所以想搞个红外遥控
我用了iremote的库文件
但是编译的时候就是不通过
选择其他的板子,如uno什么的就可以成功编译....
这是个什么情况,,,,,求解释
附,编译错误的提示信息
源代码:
- #include <IRremote.h>
- #include <IRremoteInt.h>
-
- int RECV_PIN = 7;
- int sub_PIN = 8;
- int add_PIN = 9;
-
- long on1 = 0x00FFA25D;
- long off1 = 0x00FFE01F;
- long on2 = 0x00FF629D;
- long subKey = 0x00FFA857;
- long on3 = 0x00FFE21D;
- long addKey = 0x00FF906F;
- long on4 = 0x00FF22DD;
- long off4 = 0x00FF6897;
- long on5 = 0x00FF02FD;
- long off5 = 0x00FF9867;
- long on6 = 0x00FFC23D;
- long off6 = 0x00FFB04f;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- // Dumps out the decode_results structure.
- // Call this after IRrecv::decode()
- // void * to work around compiler issue
- //void dump(void *v) {
- // decode_results *results = (decode_results *)v
- void dump(decode_results *results) {
- int count = results->rawlen;
- if (results->decode_type == UNKNOWN)
- {
- Serial.println("Could not decode message");
- }
- else
- {
- if (results->decode_type == NEC)
- {
- Serial.print("Decoded NEC: ");
- }
- else if (results->decode_type == SONY)
- {
- Serial.print("Decoded SONY: ");
- }
- else if (results->decode_type == RC5)
- {
- Serial.print("Decoded RC5: ");
- }
- else if (results->decode_type == RC6)
- {
- Serial.print("Decoded RC6: ");
- }
- Serial.print(results->value, HEX);
- Serial.print(" (");
- Serial.print(results->bits, DEC);
- Serial.println(" bits)");
- }
- Serial.print("Raw (");
- Serial.print(count, DEC);
- Serial.print("): ");
- for (int i = 0; i < count; i++)
- {
- if ((i % 2) == 1) {
- Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
- }
- else
- {
- Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
- }
- Serial.print(" ");
- }
- Serial.println("");
- }
- void setup()
- {
- pinMode(RECV_PIN, INPUT);
- pinMode(sub_PIN,OUTPUT);
- pinMode(add_PIN,OUTPUT);
- pinMode(13,OUTPUT);
- Serial.begin(9600);
- irrecv.enableIRIn(); // Start the receiver
- }
- int on = 0;
- unsigned long last = millis();
- void loop()
- {
-
- if (irrecv.decode(&results))
- {
- // If it's been at least 1/4 second since the last
- // IR received, toggle the relay
- if (millis() - last > 250)
- {
- on = !on;
- // digitalWrite(8, on ? HIGH : LOW);
- digitalWrite(RECV_PIN , on ? HIGH : LOW);
- dump(&results);
- }
- if (results.value == subKey )
- digitalWrite(sub_PIN, HIGH);
- if (results.value == subKey )
- digitalWrite(add_PIN,HIGH);
-
- last = millis();
- digitalWrite(sub_PIN, LOW);
- digitalWrite(add_PIN, LOW);
- irrecv.resume(); // Receive the next value
- }
- }
复制代码
F:\Arduino\arduino-1.0\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega8 -DF_CPU=16000000L -DARDUINO=100 -IF:\Arduino\arduino-1.0\hardware\arduino\cores\arduino -IF:\Arduino\arduino-1.0\hardware\arduino\variants\standard -IF:\Arduino\arduino-1.0\libraries\IRremote C:\HexArduino\remoteCtlLed.cpp -oC:\HexArduino\remoteCtlLed.cpp.o
remoteCtlLed.cpp: In function 'void loop()':
remoteCtlLed.cpp:110: warning: comparison between signed and unsigned integer expressions
remoteCtlLed.cpp:112: warning: comparison between signed and unsigned integer expressions
F:\Arduino\arduino-1.0\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega8 -DF_CPU=16000000L -DARDUINO=100 -IF:\Arduino\arduino-1.0\hardware\arduino\cores\arduino -IF:\Arduino\arduino-1.0\hardware\arduino\variants\standard -IF:\Arduino\arduino-1.0\libraries\IRremote -IF:\Arduino\arduino-1.0\libraries\IRremote\utility F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp -oC:\HexArduino\IRremote\IRremote.cpp.o
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:638: warning: this decimal constant is unsigned only in ISO C90
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'COM2B1' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'COM2B1' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:200: error: 'TIMSK2' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2B' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'WGM22' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2B' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2B' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'OCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'TIMSK2' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'OCIE2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: At global scope:
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:258: warning: 'TIMER2_COMPA_vect' appears to be a misspelled signal handler
|