damellis / attiny

ATtiny microcontroller support for the Arduino IDE
720 stars 226 forks source link

I am getting the following error when i am compiling the code by selecting the board as attiny85, and if i compile the same code by selecting board as arduino nano ,i am getting no error. please help #138

Open kamaluddin786 opened 2 years ago

kamaluddin786 commented 2 years ago

Code :

include

IRrecv irrecv(0); decode_results results;

int lig1 = 1; int lig2 = 2; int lig3 = 3; int lig4 = 4;

int flag1 = 0; int flag2 = 0; int flag3 = 0; int flag4 = 0;

unsigned int value;

void setup() { irrecv.enableIRIn();

pinMode(lig1, OUTPUT); pinMode(lig2, OUTPUT); pinMode(lig3, OUTPUT); pinMode(lig4, OUTPUT);

}

void loop() { if (irrecv.decode(&results)) { value = results.value; irrecv.resume();

if (results.value == 0x1FE50AF) {flag1 = !flag1; digitalWrite(lig1, flag1 ? HIGH : LOW); value =0; }
if (results.value == 0x1FED827) {flag2 = !flag2; digitalWrite(lig2, flag2 ? HIGH : LOW); value =0; }
if (results.value == 0x1FEF807) {flag3 = !flag3; digitalWrite(lig3, flag3 ? HIGH : LOW); value =0; }
if (results.value == 0x1FE30CF) {flag4 = !flag4; digitalWrite(lig4, flag4 ? HIGH : LOW); value =0; }
if (results.value == 0x1FE48B7)
{digitalWrite(lig1 , LOW);
digitalWrite(lig2, LOW);
digitalWrite(lig3 , LOW);
digitalWrite(lig4 , LOW);

}    

} } ERROR :

In file included from C:\Users\Kamal\Documents\Arduino\libraries\IRremote\src/IRremote.h:197:0, from C:\Users\Kamal\Desktop\IR_home_automation_code\IR_home_automation_code.ino:1: C:\Users\Kamal\Documents\Arduino\libraries\IRremote\src/IRReceive.hpp: In member function 'bool IRrecv::decode(decode_results*)': C:\Users\Kamal\Documents\Arduino\libraries\IRremote\src/IRReceive.hpp:1410:9: error: 'Serial' was not declared in this scope Serial.println( ^~ C:\Users\Kamal\Documents\Arduino\libraries\IRremote\src/IRReceive.hpp:1410:9: note: suggested alternative: 'Stream' Serial.println( ^~ Stream exit status 1 Error compiling for board ATtiny.

Anybody please help