Now, we write the main modules for uploading the reference image, where the IR sensor detects the presence and triggers Pi to capture the image, and send it to S3, and then to Rekognition to be stored in the collection.
Create a file with the name UploadImageIR.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.takePicture(function (callback) { var result ...