I can't get my Fingerprint door lock code to work on the Attiny85

I am trying to upload my fingerprint door lock code to the attiny85 but have been facing a lot of errors since three days.

I have tried the blink code and servo from examples and they work well with the Attiny85 -

Following is the code I’m using-

char foo;
#include <Servo.h>
#include <SoftwareServo.h>
#include <SoftwareServo.cpp>
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

#define rx 3 //***D3, Pin 2
#define tx 4 //***D4, Pin 3

SoftwareSerial Serial(rx, tx);

const int pinServo = 0; // servo pin
const int angleServo = 81; // Rotation angle

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial);
SoftwareServo servo; // create servo object to control a servo

void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/…
delay(100);
Serial.println("\n\nAdafruit finger detect test");

// set the data rate for the sensor serial port
finger.begin(57600);

if (finger.verifyPassword()) {
Serial.println(“Found fingerprint sensor!”);
} else {
Serial.println(“Did not find fingerprint sensor :(”);
while (1) { delay(1); }
}

finger.getTemplateCount();
Serial.print(“Sensor contains “); Serial.print(finger.templateCount); Serial.println(” templates”);
Serial.println(“Waiting for valid finger…”);
}

void open_close_door()
{
servo.attach(pinServo);
SoftwareServo::refresh();
for(int i=20; i<angleServo; i++)
{
servo.write(i);
SoftwareServo::refresh();
delay(5);
}

delay(3000);

for(int i=(angleServo-1); i>=20; i–)
{
servo.write(i);
SoftwareServo::refresh();
delay(5);
}
servo.detach();

}

void loop() // run over and over again
{
if(getFingerprintIDez()>=0)
{
open_close_door();

delay(2000);
}
delay(50); //don’t ned to run this at full speed.
}

uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image taken”);
break;
case FINGERPRINT_NOFINGER:
Serial.println(“No finger detected”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println(“Imaging error”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK success!

p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image converted”);
break;
case FINGERPRINT_IMAGEMESS:
Serial.println(“Image too messy”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println(“Could not find fingerprint features”);
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println(“Could not find fingerprint features”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println(“Found a print match!”);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println(“Communication error”);
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println(“Did not find a match”);
return p;
} else {
Serial.println(“Unknown error”);
return p;
}

// found a match!
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);

return finger.fingerID;
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;

p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;

// found a match!
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

These are the errors i’m getting with this code-

C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp: In function ‘void __vector_3()’:

C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:82:44: error: cannot convert ‘volatile uint8_t* {aka volatile unsigned char*}’ to ‘volatile uint16_t* {aka volatile unsigned int*}’ for argument ‘2’ to ‘void handle_interrupts(timer16_Sequence_t, volatile uint16_t*, volatile uint16_t*)’

handle_interrupts(_timer1, &TCNT1, &OCR1A);

^

C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp: In function ‘void initISR(timer16_Sequence_t)’:

C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:129:5: error: ‘TCCR1B’ was not declared in this scope

TCCR1B = _BV(CS11); // set prescaler of 8

^

C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:136:5: error: ‘TIFR1’ was not declared in this scope

TIFR1 |= _BV(OCF1A); // clear any pending interrupts;

^

C:\Program Files (x86)\Arduino\libraries\Servo\src\avr\Servo.cpp:137:5: error: ‘TIMSK1’ was not declared in this scope

TIMSK1 |= _BV(OCIE1A) ; // enable the output compare interrupt

^

Using library Servo at version 1.1.2 in folder: C:\Program Files (x86)\Arduino\libraries\Servo
Using library SoftwareServo in folder: C:\Users\DELL\Documents\Arduino\libraries\SoftwareServo (legacy)
Using library Adafruit-Fingerprint-Sensor-Library-master at version 1.1.0 in folder: C:\Users\DELL\Documents\Arduino\libraries\Adafruit-Fingerprint-Sensor-Library-master
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
exit status 1
Error compiling for board ATtiny25/45/85.

Please have a look at How to use the forum and edit your post accordingly. I doubt you inserted those emoji's into your code.

Next, the servo library does not work on ATTiny. There are some alternatives out there.

You include the Servo library (which is the cause of the errors) but then never use it (you’re using the SoftwareServo library instead). Delete this line:

#include <Servo.h>

and see if it compiles.