<commit_before>/*

Ultrasonic training set generator
for Espruino and Synaptic neural net

Will direct output to /dev/ttyESPFollow

Published under The Unlicense
<NAME>kins, 2nd February 2020

*/

// Define Espruino pins for PWM Servo and Ultrasonic Sensors
var FRONT_LEFT = A2;
var FRONT_RIGHT = A3;
var LEFT = A4;
var RIGHT = A5;
var BACK = A6;

var ON = 1;
var OFF = 0;

function makeReading() {
    digitalWrite(LED1, ON);
    front_left = analogRead(FRONT_LEFT);
    front_right = analogRead(FRONT_RIGHT);
    left = analogRead(LEFT);
    right = analogRead(RIGHT);
    back = analogRead(BACK);
    USB.print(
      "input:[" + 
        front_left + "," + 
        front_right + "," + 
        left + "," + 
        right + "," + 
        back + "]");
    digitalWrite(LED1, OFF);
    }

function onInit(){
  setInterval(makeReading,50);
}<commit_msg>Changes to match old code<commit_after>/*

Ultrasonic training set generator
for Espruino and Synaptic neural net

Will direct output to /dev/ttyESPFollow

Published under The Unlicense
Richard Hopkins, 2nd February 2020

*/

// Define Espruino pins for PWM Servo and Ultrasonic Sensors
var FRONT_LEFT = A2;
var FRONT_RIGHT = A3;
var LEFT = A4;
var RIGHT = A5;
var BACK = A6;

var ON = 1;
var OFF = 0;

function makeReading() {
    digitalWrite(LED1, ON);
    front_left = analogRead(FRONT_LEFT);
    front_right = analogRead(FRONT_RIGHT);
    left = analogRead(LEFT);
    right = analogRead(RIGHT);
    back = analogRead(BACK);
    message = "input:[" + 
        front_left + "," + 
        front_right + "," + 
        left + "," + 
        right + "," + 
        back + "]");
    messageStr = JSON.stringify(message);
    USB.write(messageStr);
    digitalWrite(LED1, OFF);
    }

function onInit(){
  USB.setup(115200,{bytesize:8,stopbits:1});
  setInterval(makeReading,50);
}
{'fraction_non_alphanumeric': 0.1187363834422658, 'fraction_numerical': 0.02178649237472767, 'mean_word_length': 3.1004464285714284, 'pattern_counts': {'":': 0, '<': 4, '<?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': '7130344', 'n_tokens_mistral': 661, 'n_tokens_neox': 606, 'n_words': 169}