<commit_before>#include <Servo.h> 

//#include <AcceleroMMA7361.h>

#ifndef Sensors_h
  #define Sensors_h
  #include "Sensors.h"
#endif

#ifndef Actions_h
  #define Actions_h
  #include "Actions.h"
#endif

#ifndef UnitTesting_h
  #define UnitTesting_h
  #include "UnitTesting.h"
#endif


#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
//#include <HMC5883L.h> //TODO DL UNABLE TO FIN THE LIBRARY 


/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
COSTANTI
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
const int servoSignalPin = 2;

//const int pingPinSensor1 = 9;
//const int echoPinSensor1 = 9;

const int pingPinSensor2 = 8;
const int echoPinSensor2 = 8;

const int SpeedM1 = 6; //M1 Speed Control
const int DirectionM1 = 8; //M1 Direction Control

const int SpeedM2 = 5; //M2 Speed Control
const int DirectionM2 = 7; //M2 Direction Control

const int LineTrackingSensor = 9;

const long DISTANCE_TRESHOLD = 30;

const int colorSensorPin = 2;

//Color Sensor constants
const int VCC = 12;
const int OUT = 10;
const int S2  = 8;
const int S3  = 9;
const int S0  = 6;
const int S1  = 7;

//RFID Reader
const int RST_PIN = 9; //9;
const int SS_PIN = 10; //10;

const bool DEBUG = true;

/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
VARIABILI GLOBALI
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
Servo *panningServo;
ColorSensor *colorSensor;
UltraSonicSensor *ultraSonic1;
UltraSonicSensor *ultraSonic2;
RoverMove *rover;
Panning *pan;
RFIDReader *rfidReader;
UnitTesting* testing;
//Compass* compass;//TODO DL UNABLE TO FIND THE LIBRARY FOR THE COMPASS

bool left;

bool DebugMode = true;


/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
SETUP
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
void setup() {
/*//TODO DL ALTERNATIVE A FOR SETUP
  // initialize serial communication:
  Serial.begin(9600);

  colorSensor = new ColorSensor(DEBUG, VCC, OUT, S2, S3, S0, S1);

  //Inizializzo tutti gli oggetti che mi servono
  panningServo = new Servo();
  panningServo->attach(servoSignalPin);  
  
  //Centra il servo  
  panningServo->write(90);
  delay(500);

  //Inizializzazione delle varie classi
  ultraSonic2 = new UltraSonicSensor(DEBUG, pingPinSensor2, echoPinSensor2);
  rover = new RoverMove(DEBUG, SpeedM1, DirectionM1, SpeedM2, DirectionM2);
  pan = new Panning(DEBUG, panningServo);
  rfidReader = new RFIDReader(DEBUG, RST_PIN, SS_PIN);

  //Sul rover non c'é l'I2C
  //compass = new Compass(DEBUG);
  
  //Inizializzazione classe di testing
  testing = new UnitTesting();
  
  //Inizializzazione variabili line follower
  pinMode(LineTrackingSensor, INPUT);
  left = true;*/
}


/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
LOOP
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
void loop()
{
  //TODO DL ALTERNATIVE A FORLOOP
  Test();
  
  
  /*
  *******************************************************
  *******************************************************
  LOGICHE ROVER
  *******************************************************
  *******************************************************
  */
  //UltraSonicRover();
  
  //LineFollower();  
}


void Test()
{
  //Movimento rover
//  rover->Forward(1200);
//  rover->Halt(3000);

    //Color Sensor
//  struct RGB rgb;
//  rgb = colorSensor->GetRGB();
//  Serial.print("R: "); 
//  Serial.print(rgb.R); 
//  Serial.print(", G: "); 
//  Serial.print(rgb.G); 
//  Serial.print(", B: "); 
//  Serial.println(rgb.B); 
  
  //RFID
  long id = rfidReader->GetUID();

  //Compass
  //Serial.println(compass->ReadPosition());
  //delay(200);


  //Color Sensor
  //testing->testColorSensor(VCC, OUT, S2 S3, S0, S1);

  //Ultrasonic Sensor
  //testing->GetDistance(ultraSonic2);
  //delay(100);
}

/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
ULTRASONIC ROVER
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************<commit_msg>Bug fix<commit_after>#include <Servo.h> 

//#include <AcceleroMMA7361.h>

#ifndef Sensors_h
  #define Sensors_h
  #include "Sensors.h"
#endif

#ifndef Actions_h
  #define Actions_h
  #include "Actions.h"
#endif

#ifndef UnitTesting_h
  #define UnitTesting_h
  #include "UnitTesting.h"
#endif


#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
//#include <HMC5883L.h> //TODO DL UNABLE TO FIN THE LIBRARY 


/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
COSTANTI
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
const int servoSignalPin = 2;

//const int pingPinSensor1 = 9;
//const int echoPinSensor1 = 9;

const int pingPinSensor2 = 8;
const int echoPinSensor2 = 8;

const int SpeedM1 = 6; //M1 Speed Control
const int DirectionM1 = 8; //M1 Direction Control

const int SpeedM2 = 5; //M2 Speed Control
const int DirectionM2 = 7; //M2 Direction Control

const int LineTrackingSensor = 9;

const long DISTANCE_TRESHOLD = 30;

const int colorSensorPin = 2;

//Color Sensor constants
const int VCC = 12;
const int OUT = 10;
const int S2  = 8;
const int S3  = 9;
const int S0  = 6;
const int S1  = 7;

//RFID Reader
const int RST_PIN = 9; //9;
const int SS_PIN = 10; //10;

const bool DEBUG = true;

/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
VARIABILI GLOBALI
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
Servo *panningServo;
ColorSensor *colorSensor;
UltraSonicSensor *ultraSonic1;
UltraSonicSensor *ultraSonic2;
RoverMove *rover;
Panning *pan;
RFIDReader *rfidReader;
UnitTesting* testing;
//Compass* compass;//TODO DL UNABLE TO FIND THE LIBRARY FOR THE COMPASS

bool left;

bool DebugMode = true;


/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
SETUP
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
void setup() {
  //TODO DL ALTERNATIVE A FOR SETUP
  // initialize serial communication:
  Serial.begin(9600);

  colorSensor = new ColorSensor(DEBUG, VCC, OUT, S2, S3, S0, S1);

  //Inizializzo tutti gli oggetti che mi servono
  panningServo = new Servo();
  panningServo->attach(servoSignalPin);  
  
  //Centra il servo  
  panningServo->write(90);
  delay(500);

  //Inizializzazione delle varie classi
  ultraSonic2 = new UltraSonicSensor(DEBUG, pingPinSensor2, echoPinSensor2);
  rover = new RoverMove(DEBUG, SpeedM1, DirectionM1, SpeedM2, DirectionM2);
  pan = new Panning(DEBUG, panningServo);
  rfidReader = new RFIDReader(DEBUG, RST_PIN, SS_PIN);

  //Sul rover non c'é l'I2C
  //compass = new Compass(DEBUG);
  
  //Inizializzazione classe di testing
  testing = new UnitTesting();
  
  //Inizializzazione variabili line follower
  pinMode(LineTrackingSensor, INPUT);
  left = true;
}


/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
LOOP
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
*/
void loop()
{
  //TODO DL ALTERNATIVE A FORLOOP
  Test();
  
  
  /*
  *******************************************************
  *******************************************************
  LOGICHE ROVER
  *******************************************************
  *******************************************************
  */
  //UltraSonicRover();
  
  //LineFollower();  
}


void Test()
{
  //Movimento rover
//  rover->Forward(1200);
//  rover->Halt(3000);

    //Color Sensor
//  struct RGB rgb;
//  rgb = colorSensor->GetRGB();
//  Serial.print("R: "); 
//  Serial.print(rgb.R); 
//  Serial.print(", G: "); 
//  Serial.print(rgb.G); 
//  Serial.print(", B: "); 
//  Serial.println(rgb.B); 
    
  //RFID
  long id = rfidReader->GetUID();

  //Compass
  //Serial.println(compass->ReadPosition());
  //delay(200);


  //Color Sensor
  //testing->testColorSensor(VCC, OUT, S2 S3, S0, S1);

  //Ultrasonic Sensor
  //testing->GetDistance(ultraSonic2);
  //delay(100);
}

/*
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
ULTRASONIC ROVER
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
****************************************************************************
{'fraction_non_alphanumeric': 0.6164535853251807, 'fraction_numerical': 0.013340744858254585, 'mean_word_length': 8.419502617801047, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, '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': '7468079', 'n_tokens_mistral': 3224, 'n_tokens_neox': 2686, 'n_words': 639}