<commit_before>/*
MIT License

Copyright (c) 2016 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#include <Zackernel.h>

#define LED1 9    // I/O Port of LED 1
#define LED2 10   // I/O Port of LED 2
#define LED3 11   // I/O Port of LED 3

#define TIC 100   // Unit Time of Blinking (msec)

void setup() {
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  Zackernel::init(); // initializing Zackernel
}

// Blink LED1 using sleep()
void blink_led1() {
  digitalWrite(LED1, HIGH);
  sleep(TIC, [&] {
     digitalWrite(LED1, LOW);
     sleep(TIC, [&] {
       digitalWrite(LED1, HIGH);
       sleep(TIC, [&] {
         digitalWrite(LED1, LOW);
         sleep(TIC, [&] {});
       });
     });
  });
}

// Blink LED2 using sleep()
void blink_led2() {
  digitalWrite(LED2, HIGH);
  sleep(TIC * 2, [&] {
     digitalWrite(LED2, LOW);
     sleep(TIC * 2, [&] {});
  });
}

// Blink LED3 using sleep()
void blink_led3() {
  digitalWrite(LED3, LOW);
  sleep(TIC * 2, [&] {
     digitalWrite(LED3, HIGH);
     sleep(TIC * 2, [&] {});
  });
}

// Loop and Fork Tasks for blinking LED1, LED2 and LED3
void loop() {
  fork(blink_led1, [&] { fork(blink_led2, blink_led3); });
}<commit_msg>Follow the Arduino Coding Rules #4<commit_after>/*
  Blink 3 LEDs
  Run the following tasks, concurrently and repeatedly:
  * blinkLed1: Turns on the LED1 on for 100ms, then off for 100msec, then on for 100ms, then off for 100msec.
  * blinkLed2: Turns on the LED2 on for 200ms, then off for 200msec.
  * blinkLed3: Turns on the LED3 off for 200ms, then on for 200msec.

  The circuit:
  * LED1: pin 9
  * LED2: pin 10
  * LED3: pin 11

  Created 1 Sep 2016
  By <NAME>
  Modified 4 Sep 2016
  By <NAME>
*/

#include <Zackernel.h>

const int LED1 = 9;    // I/O Port of LED 1
const int LED2 = 10;   // I/O Port of LED 2
const int LED3 = 11;   // I/O Port of LED 3

const int TIC = 100;   // Unit Time of Blinking (msec)

void setup() {
  // setup pinMode of LEDs
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);

  // initializing Zackernel
  Zackernel::init();
}

// Loop and Fork Tasks for blinking LED1, LED2 and LED3
void loop() {
  // fork subroutines (blinkLed1, blinkLed2, blinkLed3)
  // these will be running concurrently.
  fork(blinkLed1, [&] { fork(blinkLed2, blinkLed3); });
}

// Blink LED1 with sleeping and awaking
void blinkLed1() {
  digitalWrite(LED1, HIGH);
  sleep(TIC, [&] {
     digitalWrite(LED1, LOW);
     sleep(TIC, [&] {
       digitalWrite(LED1, HIGH);
       sleep(TIC, [&] {
         digitalWrite(LED1, LOW);
         sleep(TIC, [&] {});
       });
     });
  });
}

// Blink LED2 with sleeping and awaking
void blinkLed2() {
  digitalWrite(LED2, HIGH);
  sleep(TIC * 2, [&] {
     digitalWrite(LED2, LOW);
     sleep(TIC * 2, [&] {});
  });
}

// Blink LED3 with sleeping and awaking
void blinkLed3() {
  digitalWrite(LED3, LOW);
  sleep(TIC * 2, [&] {
     digitalWrite(LED3, HIGH);
     sleep(TIC * 2, [&] {});
  });
}

{'fraction_non_alphanumeric': 0.12093726379440665, 'fraction_numerical': 0.035021415973796925, 'mean_word_length': 3.232409381663113, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '4475049', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1383, 'n_words': 488}