<commit_before>/*
 * File name: TinkerTie.ino
 * Author: <NAME>
 * How to use:
 *  modify the animations.h file to make the desired animations.
 * License:
 *  May be modified, and reused freely. Attribution is requested. I'd also love to hear about your animations on twitter @tmakaro
 */
#include <Adafruit_NeoPixel.h>
#include <CapacitiveSensor.h>
#include "animations.h"

#define buttonPin 12
#define buttonPowerPin 13
#define groundPin 10
#define seedPin A2

CapacitiveSensor capSensor = CapacitiveSensor(3, 1);
bool emergency = false;

void setup() {
  bowtie.begin();
  bowtie.setBrightness(6);
  bowtie.show(); // Initialize all pixels to 'off'
  
  //For the extra button
  pinMode(buttonPin, INPUT);
  pinMode(buttonPowerPin, OUTPUT);
  pinMode(groundPin, OUTPUT);
  digitalWrite(buttonPowerPin, HIGH);
  digitalWrite(groundPin, LOW);
  
  emergency = (digitalRead(buttonPin) == HIGH);
  if (emergency){
    bowtie.setBrightness(255);
  }
  
  randomSeed(analogRead(seedPin));
  initializeAnimations();
}

void loop() {
  aniProfileButton();
  colourProfileButton();
  
  if (!emergency) callAnimation();
  else callEmergency();

  bowtie.show();
}

void aniProfileButton() {
  static long state_prev = capSensor.capacitiveSensor(30);
  long state_curr = capSensor.capacitiveSensor(30);

  if ((state_curr <= 40) && (state_prev >= 50)) { //on short button release
    nextAnimationProfile();
  }
  state_prev = state_curr;
}

void colourProfileButton(){
  static int state_prev = digitalRead(buttonPin);
  int state_curr = digitalRead(buttonPin);
  
  if (state_curr == LOW and state_prev == HIGH){
    nextColourProfile();
  }
  state_prev = state_curr;
}

void callEmergency(){
  for (byte i = 0; i < 27; i++){<commit_msg>lowered the brightness and fixed the last led in emergency mode<commit_after>/*
 * File name: TinkerTie.ino
 * Author: <NAME>
 * How to use:
 *  modify the animations.h file to make the desired animations.
 * License:
 *  May be modified, and reused freely. Attribution is requested. I'd also love to hear about your animations on twitter @tmakaro
 */
#include <Adafruit_NeoPixel.h>
#include <CapacitiveSensor.h>
#include "animations.h"

#define buttonPin 12
#define buttonPowerPin 13
#define groundPin 10
#define seedPin A2

CapacitiveSensor capSensor = CapacitiveSensor(3, 1);
bool emergency = false;

void setup() {
  bowtie.begin();
  bowtie.setBrightness(5);
  bowtie.show(); // Initialize all pixels to 'off'
  
  //For the extra button
  pinMode(buttonPin, INPUT);
  pinMode(buttonPowerPin, OUTPUT);
  pinMode(groundPin, OUTPUT);
  digitalWrite(buttonPowerPin, HIGH);
  digitalWrite(groundPin, LOW);
  
  emergency = (digitalRead(buttonPin) == HIGH);
  if (emergency){
    bowtie.setBrightness(255);
  }
  
  randomSeed(analogRead(seedPin));
  initializeAnimations();
}

void loop() {
  aniProfileButton();
  colourProfileButton();
  
  if (!emergency) callAnimation();
  else callEmergency();

  bowtie.show();
}

void aniProfileButton() {
  static long state_prev = capSensor.capacitiveSensor(30);
  long state_curr = capSensor.capacitiveSensor(30);

  if ((state_curr <= 40) && (state_prev >= 50)) { //on capacitive button release
    nextAnimationProfile();
  }
  state_prev = state_curr;
}

void colourProfileButton(){
  static int state_prev = digitalRead(buttonPin);
  int state_curr = digitalRead(buttonPin);
  
  if (state_curr == LOW and state_prev == HIGH){
    nextColourProfile();
  }
  state_prev = state_curr;
}

void callEmergency(){
  for (byte i = 0; i < 28; i++){
{'fraction_non_alphanumeric': 0.11978427476582458, 'fraction_numerical': 0.013624751632131706, 'mean_word_length': 4.463565891472868, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '7184612', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1174, 'n_words': 317}