Upload reference image module code

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 ...

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.