Skip to content

Commit

Permalink
Revert "Revert "Code""
Browse files Browse the repository at this point in the history
This reverts commit 2d5312e.
  • Loading branch information
oguzhanaksoy committed May 22, 2015
1 parent 2d5312e commit 567b89e
Show file tree
Hide file tree
Showing 3 changed files with 354 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
216 changes: 216 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml
*.publishproj

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

#############
## Windows detritus
#############

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store


#############
## Python
#############

*.py[cod]

# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg
121 changes: 121 additions & 0 deletions mesafe2.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

#include <AFMotor.h>

AF_DCMotor motor1(3, MOTOR12_64KHZ); //Left Motor
AF_DCMotor motor2(4, MOTOR12_64KHZ); //Right Motor


//Right Sensor
const int trigPin =2;
const int echoPin =9;


//Left Sensor
const int trigPin1 =10;
const int echoPin1 =13;

//Front Sensor
const int trigPin2 =A0;
const int echoPin2 =A1;


void setup() {
motor1.setSpeed(255);
motor2.setSpeed(249);
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(trigPin1,OUTPUT);
pinMode(trigPin2,OUTPUT);
delay(2000);
}

int sagSensor,solSensor,onSensor;
void loop()
{

sagSensor = mesafeOlc(echoPin,trigPin);
solSensor = mesafeOlc(echoPin1,trigPin1);
onSensor = mesafeOlc(echoPin2,trigPin2);

if(onSensor <= 15){
if(sagSensor >= 15){
sifirla(1);
sagaDon(850);
}else if(solSensor >= 15){
sifirla(0);
solaDon(850);
}else{
sifirla(0);
solaDon(1700);
}
}else{
ileri();
}


delay(250);
}

long microsaniyeSure, cmMesafe; // Mesafe hesabında kullanılan değişkenler
int c=0;
long mesafeOlc(int echo,int trig){
digitalWrite(trig, LOW); // Hoparlör 2ms sessiz
delayMicroseconds(2);
digitalWrite(trig, HIGH); // Hoparlör 10ms sesli
delayMicroseconds(10);
digitalWrite(trig, LOW); // Hoparlör sessiz
microsaniyeSure = pulseIn(echo, HIGH); // Mikrofonu dinle, yansıma süresini microsaniyeSure değişkenine al
cmMesafe = microsaniyeSure/58.2; // microsaniyeSure'dan cm olarak mesafeyi hesapla
return cmMesafe;
}

void sol(bool yon)
{
if(yon)
motor1.run(FORWARD);
else
motor1.run(BACKWARD);

}

void sifirla(int saniye)
{
motor1.run(RELEASE);
motor2.run(RELEASE);
delay(saniye);
}

void sag(bool yon)
{
if(yon)
motor2.run(FORWARD);
else
motor2.run(BACKWARD);

}

void ileri()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);

}


void solaDon(int saniye){
sag(true);
sol(false);
delay(saniye);
sifirla(100);
}

void sagaDon(int saniye)
{
sol(true);
sag(false);
delay(saniye);
sifirla(100);
}



0 comments on commit 567b89e

Please sign in to comment.