Define pins

This commit is contained in:
Denis Zheleztsov 2018-11-22 11:51:20 +03:00
parent 6a43957bd6
commit 7691378312
Signed by: Difrex
GPG Key ID: B047A0E62A285621

20
car.ino
View File

@ -5,21 +5,21 @@
/* Define your pins here */ /* Define your pins here */
/* Wheels */ /* Wheels */
const int left_wheel_1 = 0; #define left_wheel_1 0
const int left_wheel_2 = 1; #define left_wheel_2 1
const int right_wheel_1 = 2; #define right_wheel_1 2
const int right_wheel_2 = 3; #define right_wheel_2 3
/* Ultrasonic sensor */ /* Ultrasonic sensor */
const int sensor_echo = 9; #define sensor_echo 9
const int sensor_trigger = 10; #define sensor_trigger 10
/* Other constans */ /* Other constans */
const int move_delay = 500; #define move_delay 500
const int turn_delay = 500; #define turn_delay 500
/* disconnected pin for random seed */ /* disconnected pin for random seed */
const int analog_disconnected = 0; #define analog_disconnected 0
/* Initialize sensor class */ /* Initialize sensor class */
HCSR04 hcsr04(sensor_trigger, sensor_echo, 20, 4000); HCSR04 hcsr04(sensor_trigger, sensor_echo, 20, 4000);
@ -137,7 +137,7 @@ int get_distance() {
he must do the following actions: he must do the following actions:
* stop the wheels * stop the wheels
* turn on wheels to go backward for 1 second * turn on wheels to go backward
* stop wheels * stop wheels
* turn left or right * turn left or right
* then go forward * then go forward