<commit_before>var events = require('events'),
    util = require('util');

/*
 * Main Sensor constructor
 * Process options
 * Tell the board to set it up
 */
var Sensor = function (options) {
  if (!options || !options.board) throw new Error('Must supply required options to Sensor');
  this.board = options.board;
  this.pin = options.pin || 'A0';
  this.board.pinMode(this.pin, 'in');

  // Poll for sensor readings
  setInterval(function () {
    this.board.analogRead(this.pin);
  }.bind(this), 50);

  // When data is received, parse inbound message
  // match pin to instance pin value
  this.board.on('data', function (m) {
    var m = message.slice(0, -1).split('::'),
        pin, data;

    if (!m.length) {
      return;
    }

    pin = m[0]
    data = m.length === 2 ? m[1] : null;

    if (pin === this.pin) {
      this.emit('read', data);
    }
  }.bind(this));
};

/*
 * EventEmitter, I choose you!
 */
util.inherits(Sensor, events.EventEmitter);

module.exports = Sensor;<commit_msg>Fixes m=>message bug.<commit_after>var events = require('events'),
    util = require('util');

/*
 * Main Sensor constructor
 * Process options
 * Tell the board to set it up
 */
var Sensor = function (options) {
  if (!options || !options.board) throw new Error('Must supply required options to Sensor');
  this.board = options.board;
  this.pin = options.pin || 'A0';
  this.board.pinMode(this.pin, 'in');

  // Poll for sensor readings
  setInterval(function () {
    this.board.analogRead(this.pin);
  }.bind(this), 50);

  // When data is received, parse inbound message
  // match pin to instance pin value
  this.board.on('data', function (message) {
    var m = message.slice(0, -1).split('::'),
        pin, data;

    if (!m.length) {
      return;
    }

    pin = m[0]
    data = m.length === 2 ? m[1] : null;

    if (pin === this.pin) {
      this.emit('read', data);
    }
  }.bind(this));
};

/*
 * EventEmitter, I choose you!
 */
util.inherits(Sensor, events.EventEmitter);

module.exports = Sensor;
{'fraction_non_alphanumeric': 0.16683168316831684, 'fraction_numerical': 0.007920792079207921, 'mean_word_length': 2.947265625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4065773', 'n_tokens_mistral': 684, 'n_tokens_neox': 666, 'n_words': 187}