<commit_before>
var Anodia;
var five = require("johnny-five");
var SerialPort = require("serialport").SerialPort;

var Communication_Arduino = {

	arduino: null,

	init: function(anodia,callback) {

		Anodia = anodia;
		this.arduino = new five.Board({repl:false,debug:false});

		this.arduino.on("error", function(msg) {
			Anodia.log(1,msg);
		});

		this.arduino.on("connect", function() {
			Anodia.log(2,"Arduino is connected");
		})

		this.arduino.on("ready", function() {
			Anodia.log(2,"Arduino is ready");
			callback(null);
		});
	},

	run: function() {

	}
};

module.exports = Communication_Arduino;<commit_msg>Brushing some code<commit_after>
var Anodia;
var five = require("johnny-five");
var SerialPort = require("serialport").SerialPort;

var Communication_Arduino = {

	arduino: null,

	init: function(anodia,callback) {

		Anodia = anodia;
		this.arduino = new five.Board({repl:false,debug:false});

		this.arduino.on("error", function(msg) {
			Anodia.log(1,msg);
		});

		this.arduino.on("connect", function() {
			Anodia.log(2,"Arduino is connected");
		})

		this.arduino.on("ready", function() {

			this.arduino.sensor = new five.Sensor({ pin: "A0", freq: 1000});

			Anodia.log(2,"Arduino is ready");
			callback(null);
		}.bind(this));
	},

	run: function() {

	},

	command: function(args) {
		var pin = args.shift();
		var action = args.shift();

		if (pin == "A0") {
			if (action == "value") {
				console.log(this.temperature(this.arduino.sensor.raw));
			} else {
				console.log("Unknown action: "+action);
			}
		} else {
			console.log("Unknown pin: "+pin);
		}
	},

	temperature: function(temp) {

		var thermistornominal = 100000;
		var temperaturenominal = 25;
		var bcoefficient = 3950;
		var seriesresistor = 68500;

		temp = seriesresistor / (1023 / temp - 1);

		return (1.0 / ((Math.log(temp / thermistornominal) / bcoefficient) + (1.0/(temperaturenominal + 273.15)))) - 273.15 ;
	}
};

module.exports = Communication_Arduino;
{'fraction_non_alphanumeric': 0.17411167512690356, 'fraction_numerical': 0.024365482233502538, 'mean_word_length': 3.9398496240601504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2687420', 'n_tokens_mistral': 850, 'n_tokens_neox': 709, 'n_words': 135}