<commit_before>/*
 * Driver for a little analog distance sensor to i2c
 */

#include <Wire.h>

// Command defintions
byte ENABLE_INTERRUPT=1;
byte SET_INTERRUPT_DISTANCE=2;
byte READ_INTERRUPT_DISTANCE=4;
byte READ_MAX_MIN=8;

void setup(){
  Wire.begin();        // join i2c bus (address optional for master)
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
}

void loop()
{
  delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
}
<commit_msg>More work on i2c Sensor board :)<commit_after>/*
 * Driver for a little analog distance sensor to i2c
 */

#include <Wire.h>

// Command defintions
byte ENABLE_INTERRUPT=1;
byte SET_INTERRUPT_DISTANCE=2;
byte READ_INTERRUPT_DISTANCE=3;
byte SENSOR_DATA=4;

#define REG_MAP_SIZE 4
#define SLAVE_ADDRESS  0x01
//data
byte data[8];


void setup(){
  Wire.begin(SLAVE_ADDRESS);        // join i2c bus 
  
  Wire.onReceive(receiveEvent); // register event
  Wire.onRequest(requestEvent);
  
  Serial.begin(9600);           // start serial for output
}

void loop()
{
  delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
}

void requestEvent(){
  Wire.write(data, REG_MAP_SIZE);  //Set the buffer up to send all 14 bytes of dat
}

{'fraction_non_alphanumeric': 0.10919822921790458, 'fraction_numerical': 0.017707820954254796, 'mean_word_length': 3.125760649087221, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5607854', 'n_tokens_mistral': 672, 'n_tokens_neox': 635, 'n_words': 219}