<commit_before>/*
SharpDistSensorBasic.ino
Source: https://github.com/DrGFreeman/SharpDistSensor
MIT License
Copyright (c) 2017 <NAME> <<EMAIL>>
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.
*/

/*
This example shows how to use the SharpDistSensor library to continuously
read the sensor and display the analog value and the corrseponding distance
in mm.
The library default values corresponding to the Sharp GP2Y0A60SZLF 5V sensor
are used.
See the library README for how to use pre-defined sensor models or custom
fit functions.
*/

#include <SharpDistSensor.h>

// Analog pin to which the sensor is connected
const byte sensorPin = A0; //right IR sensor
const byte sensorPin2 = A1; //left IR sensor
const byte backleft = A6; //back-left line sensor
const byte backright = A7; //back-right line sensor
const byte frontright = A2; //front-left line sensor
const byte frontleft = A3; //front-right line sensor
const byte sideleft = A4; //A4: left peripheral sensor
const byte sideright = A5;//A5: right peripheral sensor

// Window size of the median filter (odd number, 1 = no filtering)
const byte mediumFilterWindowSize = 5;
unsigned int rightDist; //distance from right sensor
unsigned int leftDist; //distance from left sensor
unsigned int perRightDist; //distance from peripheral right sensor
unsigned int perLeftDist; //distance from peripheral left sensor

// Create an object instance of the SharpDistSensor class
SharpDistSensor sensor(sensorPin, mediumFilterWindowSize); //right sensor
SharpDistSensor sensor2(sensorPin2, mediumFilterWindowSize); //left sensor
int STBY = 10; //standby

//Right Motor (? I'm not too sure about this)
int PWMA = 3; //Speed control
int AIN1 = 9; //Direction
int AIN2 = 8; //Direction

//Left Motor (? also not too sure about this)
int PWMB = 5; //Speed control
int BIN1 = 11; //Direction
int BIN2 = 12; //Direction

char past; //what direction the robot was moving previously
int count; //counter for how long before the rebot gives up searching in one direction
int threshold; //threshold for line sensors
int cur; // current time
int initTime; // time after initialization
short iter;<commit_msg>fixed compile errors<commit_after>/*
SharpDistSensorBasic.ino
Source: https://github.com/DrGFreeman/SharpDistSensor
MIT License
Copyright (c) 2017 <NAME> <<EMAIL>>
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.
*/

/*
This example shows how to use the SharpDistSensor library to continuously
read the sensor and display the analog value and the corrseponding distance
in mm.
The library default values corresponding to the Sharp GP2Y0A60SZLF 5V sensor
are used.
See the library README for how to use pre-defined sensor models or custom
fit functions.
*/

#include <SharpDistSensor.h>

// Analog pin to which the sensor is connected
const byte sensorPin = A0; //right IR sensor
const byte sensorPin2 = A1; //left IR sensor
const byte backleft = A6; //back-left line sensor
const byte backright = A7; //back-right line sensor
const byte frontright = A2; //front-left line sensor
const byte frontleft = A3; //front-right line sensor
const byte sensorPin4 = A4; //A4: left peripheral sensor
const byte sensorPin3 = A5;//A5: right peripheral sensor

// Window size of the median filter (odd number, 1 = no filtering)
const byte mediumFilterWindowSize = 5;
unsigned int rightDist; //distance from right sensor
unsigned int leftDist; //distance from left sensor
unsigned int perRightDist; //distance from peripheral right sensor
unsigned int perLeftDist; //distance from peripheral left sensor

// Create an object instance of the SharpDistSensor class
SharpDistSensor sensor(sensorPin, mediumFilterWindowSize); //right sensor
SharpDistSensor sensor2(sensorPin2, mediumFilterWindowSize); //left sensor
SharpDistSensor sideright(sensorPin3, mediumFilterWindowSize); //right peripheral sensor
SharpDistSensor sideleft(sensorPin4, mediumFilterWindowSize); //left peripheral sensor
int STBY = 10; //standby

//Right Motor (? I'm not too sure about this)
int PWMA = 3; //Speed control
int AIN1 = 9; //Direction
int AIN2 = 8; //Direction

//Left Motor (? also not too sure about this)
int PWMB = 5; //Speed control
int BIN1 = 11; //Direction
int BIN2 = 12; //Direction

char past; //what direction the robot was moving previously
int count; //counter for how long before the rebot gives up searching in one direction
int threshold; //threshold for line sensors
int cur; // current time
int initTime; // time after initialization
short iter;
{'fraction_non_alphanumeric': 0.06327930174563591, 'fraction_numerical': 0.012468827930174564, 'mean_word_length': 4.6141732283464565, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '2395595', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1635, 'n_words': 899}