Skip to content

Tynab/Obstacle-Avoiding-Robot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OBSTACLE AVOIDING ROBOT

Arduino Uno R3.

IMAGE DEMO

VIDEO DEMO

IMAGE ALT TEXT HERE

CODE DEMO

/// @brief Measure distance.
/// @return Distance.
int dokhoangcach()
{
    int kc;
    long tg;
    digitalWrite(TRIG, LOW);
    delayMicroseconds(2);
    digitalWrite(TRIG, HIGH);
    delayMicroseconds(10);
    digitalWrite(TRIG, LOW);
    tg = pulseIn(ECHO, HIGH, 3600000);
    kc = int(tg / 2 / 29.412);
    return kc;
}