Hello ,
I need a bit f help to programm an Attiny85 with arduino uno.
I have combined some projects that i found on the internet and I came up with this that works totaly fine with the arduino. But when I try to upload this to the attiny85 , it says :
Board: "ATtiny85 (internal 8 MHz clock)"
sketch_dec31c.ino: In function 'void setup()':
sketch_dec31c:20: error: 'Serial' was not declared in this scope
sketch_dec31c.ino: In function 'void loop()':
sketch_dec31c:53: error: 'Serial' was not declared in this scope
And here is the code.... if anyone can help please reply
#include <IRremote.h>
int RECV_PIN = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long CurrentValue = 0;
unsigned long StoredCode = 0;
const int buttonPin = 1;
const int ledPin = 2;
const int outputPin = 3;
const int relayPin = 4;
int buttonState = 0;
int RecordState = 0;
int outputState = 1;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
pinMode(ledPin, OUTPUT);
pinMode(outputPin, OUTPUT);
pinMode(relayPin, OUTPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (irrecv.decode(&results)) {
CurrentValue = (results.value);
if(CurrentValue == StoredCode) {
outputState = !outputState;
}
if (RecordState == 1) {
StoredCode = CurrentValue;
RecordState = 0;
digitalWrite(ledPin, LOW);
Serial.print(StoredCode);
}
irrecv.resume();
}
else
{
CurrentValue = 0;
}
if (buttonState == HIGH) {
while (buttonState == HIGH) {
buttonState = digitalRead(buttonPin);
}
digitalWrite(ledPin, HIGH);
RecordState = 1;
}
if(outputState == 1) {
digitalWrite(outputPin, HIGH);
digitalWrite(relayPin, HIGH);
}
else {
digitalWrite(outputPin, LOW);
digitalWrite(relayPin, LOW);
}
}