98
www.keyestudio.com
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
duration = pulseIn(echoPin, HIGH);
// Convert the time into a distance
cm = (duration/2) / 29.1;
// Divide by 29.1 or multiply by 0.0343
inches = (duration/2) / 74;
// Divide by 74 or multiply by 0.0135
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Summary of Contents for Smart Little Turtle Robot V3
Page 5: ...5 www keyestudio com 1 Introduction...
Page 16: ...16 www keyestudio com...
Page 17: ...17 www keyestudio com...
Page 18: ...18 www keyestudio com...
Page 19: ...19 www keyestudio com...
Page 22: ...22 www keyestudio com...
Page 24: ...24 www keyestudio com...
Page 25: ...25 www keyestudio com...
Page 26: ...26 www keyestudio com...
Page 28: ...28 www keyestudio com...
Page 29: ...29 www keyestudio com...
Page 30: ...30 www keyestudio com...
Page 31: ...31 www keyestudio com Step 7 Hook up Guide...
Page 32: ...32 www keyestudio com...
Page 33: ...33 www keyestudio com...
Page 44: ...44 www keyestudio com...
Page 48: ...48 www keyestudio com 4 Arduino IDE Setting Click icon open Arduino IDE...
Page 53: ...53 www keyestudio com Set board and COM port the corresponding board and COM port are...
Page 55: ...55 www keyestudio com Click to upload the program upload successfully...
Page 59: ...59 www keyestudio com...
Page 96: ...96 www keyestudio com 5 Connection Diagram...
Page 121: ...121 www keyestudio com 6 Then pop up the following page...
Page 122: ...122 www keyestudio com 7 Click Read Notify WriteWithoutResponse to enter the following page...
Page 129: ...129 www keyestudio com...
Page 143: ...143 www keyestudio com The definition inner pins are shown below...
Page 159: ...159 www keyestudio com 3 Connection Diagram 4 Test Code...
Page 167: ...167 www keyestudio com 2 Hook up Diagram...
Page 187: ...187 www keyestudio com 8 8 LED matrix shows rightward icon Flow Chart 2 Hook up Diagram...
Page 200: ...200 www keyestudio com 5 Click to enter the main page of turtle smart car...