<commit_before>#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>

/* Set these to your desired credentials. */
const char *ssid = "ConTrolley";
const char *password = "<PASSWORD>";

const int trigPin = 5;
const int echoPin = 4;

//Ultrasonido2
const int trigPin2 = 0;
const int echoPin2 = 2;

int distance, distance2;

bool sensor1Activated = false, sensor2Activated = false;

int countIncoming = 0, countOutgoing = 0;

const long interval = 250;
unsigned long previousMillis = 0;

ESP8266WebServer server(80);

void handleRoot() {
  String stringOne = "{\"incomingCount\":";
  stringOne += countIncoming;
  stringOne += ", \"outgoingCount\":";
  stringOne += countOutgoing;
  stringOne += "}";
  
  server.send(200, "application/json", stringOne);
}

void cleanRoot() {
  countIncoming = 0;
  countOutgoing = 0;
  server.send(200, "application/json", "{\"msg\":\"Clean Data...\"}");
}

void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();
  Serial.print("Configuring access point...");
  /* You can remove the password parameter if you want the AP to be open. */
  WiFi.softAP(ssid, password);

  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/clean", cleanRoot);
  server.begin();
  Serial.println("HTTP server started");

  //Ultrasonido1
  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT); // Sets the echoPin as an Input


  pinMode(trigPin2, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin2, INPUT); // Sets the echoPin as an Inpu
}

int getDistanceFromSensor(int trig, int echo){
  digitalWrite(trig, LOW);
  delayMicroseconds(2);
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);
  return (pulseIn(echo, HIGH) / 2) / 29.1; //29.1
}

void loop() {
  server.handleClient();

  if(getDistanceFromSensor(trigPin, echoPin) <= 15){
    Serial.println("Entering...");
    sensor1Activated = true;
  }

  if(getDistanceFromSensor(trigPin2, echoPin2) <= 15){
    Serial.println("Exiting...");
    sensor2Activated = true;
  }

  while(sensor1Activated == true && sensor2Activated == false){
    server.handleClient();
    if(getDistanceFromSensor(trigPin2, echoPin2) <= 15){
      Serial.println("ENTERED");
      sensor1Activated = false;
      sensor2Activated = false;
      countIncoming += 1;
      delay(250);
      break;
    }
  }

  while(sensor2Activated == true && sensor1Activated == false){
    server.handleClient();
    if(getDistanceFromSensor(trigPin, echoPin) <= 15){
      Serial.println("EXITING");
      sensor1Activated = false;
      sensor2Activated = false;
      countOutgoing += 1;
      delay(250);
      break;
    }<commit_msg>esp software update<commit_after>#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>

const char *ssid = "ConTrolley";
const char *password = "<PASSWORD>";

const int trigPin = 5;
const int echoPin = 4;

//Ultrasonido2
const int trigPin2 = 0;
const int echoPin2 = 2;

int distance, distance2;

bool sensor1Activated = false, sensor2Activated = false, secondChecked = false;

int countIncoming = 0, countOutgoing = 0;

ESP8266WebServer server(80);

void handleRoot() {
  String stringOne = "{\"incomingCount\":";
  stringOne += countIncoming;
  stringOne += ", \"outgoingCount\":";
  stringOne += countOutgoing;
  stringOne += "}";
  
  server.send(200, "application/json", stringOne);
}

void cleanRoot() {
  countIncoming = 0;
  countOutgoing = 0;
  server.send(200, "application/json", "{\"msg\":\"Clean Data...\"}");
}

void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();
  Serial.print("Configuring access point...");
  /* You can remove the password parameter if you want the AP to be open. */
  WiFi.softAP(ssid, password);

  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/clean", cleanRoot);
  server.begin();
  Serial.println("HTTP server started");

  //Ultrasonido1
  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT); // Sets the echoPin as an Input


  pinMode(trigPin2, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin2, INPUT); // Sets the echoPin as an Inpu
}

int getDistanceFromSensor(int trig, int echo){
  digitalWrite(trig, LOW);
  delayMicroseconds(2);
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);
  return (pulseIn(echo, HIGH) / 2) / 29.1; //29.1
}

void loop() {
  server.handleClient();

  if(getDistanceFromSensor(trigPin, echoPin) <= 15){
    Serial.println("Entering...");
    sensor1Activated = true;
  }

  if(getDistanceFromSensor(trigPin2, echoPin2) <= 15){
    Serial.println("Exiting...");
    sensor2Activated = true;
  }

  while(sensor1Activated == true && sensor2Activated == false){
    server.handleClient();
    if(!secondChecked && getDistanceFromSensor(trigPin2, echoPin2) <= 15){
      Serial.println("Entered In");
      secondChecked = true;
    }else if(secondChecked && getDistanceFromSensor(trigPin2, echoPin2) >= 15){
      Serial.println("Entered Out");
      sensor1Activated = false;
      sensor2Activated = false;
      secondChecked = false;
      countIncoming += 1;
      break;
    }
  }

  while(sensor2Activated == true && sensor1Activated == false){
    server.handleClient();
    if(!secondChecked && getDistanceFromSensor(trigPin, echoPin) <= 15){
      Serial.println("Exiting In");
      secondChecked = true;
    }else if(secondChecked && getDistanceFromSensor(trigPin, echoPin) >= 15){
      Serial.println("Exiting Out");
      sensor1Activated = false;
      sensor2Activated = false;
      secondChecked = false;
      countIncoming += 1;
      break;
    }
{'fraction_non_alphanumeric': 0.14371565934065933, 'fraction_numerical': 0.030563186813186812, 'mean_word_length': 3.822019867549669, 'pattern_counts': {'":': 6, '<': 19, '<?xml version=': 0, '>': 13, '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': '2228478', 'n_tokens_mistral': 2062, 'n_tokens_neox': 1916, 'n_words': 464}