Now, finally, we write the main modules to upload the face comparison, where the IR sensor detects a presence and triggers Pi to capture the image and send it to S3 and then to Rekognition, where it compares the face with the collection:
- Create a file with the name FaceComparision.js and add the following code:
var GPIO = require('pigpio').Gpio, cameraModule = require('./CameraModuleRekognition'), s3Bucket = require('./S3Put'), green_LED = new GPIO(19,{mode: GPIO.OUTPUT}), red_LED= new GPIO(17,{mode: GPIO.OUTPUT}), IR_out= new GPIO(5,{mode: GPIO.INPUT,alert: true}); red_LED.digitalWrite(0);green_LED.digitalWrite(0); IR_out.on('alert', function(level, tick){ if(level==1){ cameraModule.takeTargetPicture(function ...