<commit_before>
const exec = require('child_process').exec;

var moment = require("moment");
var gpio = require("gpio");
var gpio4 = gpio.export(4, {
   direction: "in",
   ready: function() {
   }
});

var timestamp = moment().add(1, 'm');

// bind to the "change" event
gpio4.on("change", function(val) {

    // value will report either 1 or 0 (number) when the value changes
    console.log(val)
    if (val == 1) {
      var now = moment()
      if (now > timestamp) {
        console.log("turning on screen")
        responsiveVoice.speak("Hello, I am Jarvis. Welcome to Cardinal Solutions Group.", "UK English Male");
        const child = exec('xset s reset && xset dpms force on',
          (error, stdout, stderr) => {
            console.log(`stdout: ${stdout}`);
            console.log(`stderr: ${stderr}`);
            if (error !== null) {
              console.log(`exec error: ${error}`);
            }
        });
      }
    } else {
      timestamp = moment().add(1, 'm');
    }
});

// var proximity = proximityLib.use(triggerPin, echoPin);
//
// function printDistance() {
//   proximity.getDistance(function(err, distance) {
//     if (err) throw err;
//
//     console.log("Distance: ", distance, "cm away.");
//
//     printDistance();
//   });
// }
//
// printDistance();<commit_msg>motion js cleaned to original working state.<commit_after>
const exec = require('child_process').exec;

var moment = require("moment");

var gpio = require("gpio");
var gpio4 = gpio.export(4, {
   direction: "in",
   ready: function() {
   }
});

var timestamp = moment().add(1, 'm');

// bind to the "change" event
gpio4.on("change", function(val) {

    // value will report either 1 or 0 (number) when the value changes
    console.log(val)
    if (val == 1) {
      var now = moment()
      if (now > timestamp) {
        console.log("turning on screen")
        responsiveVoice.speak("Hello, I am Jarvis. Welcome to Cardinal Solutions Group.", "UK English Male");
        const child = exec('xset s reset && xset dpms force on',
          (error, stdout, stderr) => {
            console.log(`stdout: ${stdout}`);
            console.log(`stderr: ${stderr}`);
            if (error !== null) {
              console.log(`exec error: ${error}`);
            }
        });
      }
    } else {
      timestamp = moment().add(1, 'm');
    }
});
{'fraction_non_alphanumeric': 0.1711252653927813, 'fraction_numerical': 0.006794055201698514, 'mean_word_length': 2.409551374819103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1962091', 'n_tokens_mistral': 727, 'n_tokens_neox': 716, 'n_words': 205}