<commit_before>#include <CurieBLE.h>
#define MOTOR_PIN 6

BLEPeripheral blePeripheral;
BLEService motorService = BLEService("FFF1");

// switchCharacteristic controls motor's on/off state
BLECharCharacteristic switchCharacteristic =
  BLECharCharacteristic("FFF2", BLERead | BLEWrite);
BLEDescriptor switchDescriptor = BLEDescriptor("2901", "Switch");

// speedCharacteristic controls the motor's speed
BLEIntCharacteristic speedCharacteristic =
  BLEIntCharacteristic("FFF3", BLERead | BLEWrite);
BLEDescriptor speedDescriptor = BLEDescriptor("2901", "Speed");

void setup() {
  Serial.begin(9600);

  pinMode(MOTOR_PIN, OUTPUT);

  blePeripheral.setLocalName("Bluetooth Motor");
  blePeripheral.setDeviceName("Bluetooth Motor");
  blePeripheral.setAdvertisedServiceUuid(motorService.uuid());

  blePeripheral.addAttribute(motorService);

  blePeripheral.addAttribute(switchCharacteristic);
  blePeripheral.addAttribute(switchDescriptor);

  blePeripheral.addAttribute(speedCharacteristic);
  blePeripheral.addAttribute(speedDescriptor);

  switchCharacteristic.setEventHandler(BLEWritten, switchCharacteristicWritten);
  speedCharacteristic.setEventHandler(BLEWritten, speedCharacteristicWritten);


  blePeripheral.begin();

  while (! Serial); // Busy wait until serial ready
  Serial.println(F("Bluetooth Motor Ready!\n"));
}

void loop() {
  blePeripheral.poll();
}

void switchCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
  Serial.print(F("Characteristic event, written: "));

  if (switchCharacteristic.value()) {
    Serial.println(F("Motor on!"));<commit_msg>Cleaned up source code<commit_after>#include <CurieBLE.h>
#define MOTOR_PIN 6

BLEPeripheral blePeripheral;
BLEService motorService = BLEService("FFF1");

// switchCharacteristic controls motor's on/off state
BLECharCharacteristic switchCharacteristic =
  BLECharCharacteristic("FFF2", BLERead | BLEWrite);
BLEDescriptor switchDescriptor = BLEDescriptor("2901", "Switch");

// speedCharacteristic controls the motor's speed
BLEIntCharacteristic speedCharacteristic =
  BLEIntCharacteristic("FFF3", BLERead | BLEWrite);
BLEDescriptor speedDescriptor = BLEDescriptor("2901", "Speed");

void setup() {
  Serial.begin(9600);

  pinMode(MOTOR_PIN, OUTPUT);

  blePeripheral.setLocalName("Bluetooth Motor");
  blePeripheral.setDeviceName("Bluetooth Motor");
  blePeripheral.setAdvertisedServiceUuid(motorService.uuid());

  blePeripheral.addAttribute(motorService);

  blePeripheral.addAttribute(switchCharacteristic);
  blePeripheral.addAttribute(switchDescriptor);

  blePeripheral.addAttribute(speedCharacteristic);
  blePeripheral.addAttribute(speedDescriptor);

  switchCharacteristic.setEventHandler(BLEWritten, switchCharacteristicWritten);
  speedCharacteristic.setEventHandler(BLEWritten, speedCharacteristicWritten);


  blePeripheral.begin();

  while (! Serial); // Busy wait until serial ready
  Serial.println(F("Bluetooth Motor Ready!\n"));
}

void loop() {
  blePeripheral.poll();
}

void switchCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
  if (switchCharacteristic.value()) {
    Serial.println(F("Motor on!"));
{'fraction_non_alphanumeric': 0.10815939278937381, 'fraction_numerical': 0.010120177103099304, 'mean_word_length': 7.548648648648649, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1913125', 'n_tokens_mistral': 990, 'n_tokens_neox': 894, 'n_words': 165}