<commit_before>#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303.h>
#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial BT(10,11);
//RX/TX
Adafruit_LSM303 lsm;
boolean isBT=true;
int idString="00";
void setup() {
  // put your setup code here, to run once:
  comBegin(9600);
  //https://store.arduino.cc/usa/arduino-nano
  //https://learn.adafruit.com/lsm303-accelerometer-slash-compass-breakout/coding
  //I2C: A4 (SDA) and A5 (SCL)
  if(!lsm.begin()){
    Serial.println("unable to initialize the LSM303.");
    while(1);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  float data[6];
  getData(data);
  sendLSMData(data);
  if(comAvailable()>0){
    
  }
  delay(100);
}

void getData(float data[]){
  lsm.read();
  data[0]=(float)lsm.accelData.x;
  data[1]=(float)lsm.accelData.y;
  data[2]=(float)lsm.accelData.z;
  data[3]=(float)lsm.magData.x;
  data[4]=(float)lsm.magData.y;
  data[5]=(float)lsm.magData.z;
}

void sendLSMData(float data[]){
  mySend("x"+(String)data[0]);
  mySend("y"+(String)data[1]);
  mySend("z"+(String)data[2]);
}

<commit_msg>一つのファイルに統合<commit_after>#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303.h>
#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial BT(10,11);
//RX/TX
Adafruit_LSM303 lsm;
boolean isBT=true;
int idString="00";
void setup() {
  // put your setup code here, to run once:
  comBegin(9600);
  //https://store.arduino.cc/usa/arduino-nano
  //https://learn.adafruit.com/lsm303-accelerometer-slash-compass-breakout/coding
  //I2C: A4 (SDA) and A5 (SCL)
  if(!lsm.begin()){
    Serial.println("unable to initialize the LSM303.");
    while(1);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  float data[6];
  getData(data);
  sendLSMData(data);
  if(comAvailable()>0){
    
  }
  delay(100);
}

void getData(float data[]){
  lsm.read();
  data[0]=(float)lsm.accelData.x;
  data[1]=(float)lsm.accelData.y;
  data[2]=(float)lsm.accelData.z;
  data[3]=(float)lsm.magData.x;
  data[4]=(float)lsm.magData.y;
  data[5]=(float)lsm.magData.z;
}

void sendLSMData(float data[]){
  mySend("x"+(String)data[0]);
  mySend("y"+(String)data[1]);
  mySend("z"+(String)data[2]);
}

void comBegin(int speed){
  if(isBT){
    //passkey is <PASSWORD>
    BT.begin(speed);
  }
  else{
    Serial.begin(speed);
  }
}

void mySend(String s){
  //add device ID
  s=idString+s;
  if(isBT){
    BT.println(s);
  }
  else{
    Serial.println(s);
  }
}

boolean comAvailable(){
  boolean value;
  if(isBT){
    value=BT.available(); 
  }
  else{
    value=Serial.available();
  }
  return value;
}



{'fraction_non_alphanumeric': 0.1899075500770416, 'fraction_numerical': 0.030816640986132512, 'mean_word_length': 4.032945736434108, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 4, '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': '4009643', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1105, 'n_words': 181}