Autonomous car – Week 12


Abdiqani: 

This week I have tried to integrate the communication into Alinur’s car, I first had to wait until the car was driving and then I tried to implement a little snippet that would send data when the car moves forward or backward. The problem I encountered was that he used Bluetooth while I had used the radio, and using both at the same time does not work. Which is why I have had to try and send and receive data with the micro bit using Bluetooth.  

When I had access to two microbit’s I tried the above code, which although it displayed the button pressed in the serial monitor did not display it in the other micro bit. This made me try to do it from another angle and try to first send simple messages and later add the other things which resulted in the code under, but I have not had access toa another micro bit, but I believe it will work. 

Ghebre:

The car is been able to drive by sensing the lines, and follow the instructions if the car is in one or more of the situations that the car might face while driving.

I had some issues with pin. For instance, I tried to drive the car forward, but it seems it could not let me use 19 for to purposes at the same time. The car is driving forward but the left front side get different information.

here is the code i used to control the behavior of the car.

void loop() {  

read_sensor_values(); 

Serial.print(error); 

if(error == 100){ 

do{ 

read_sensor_values(); 

//call speed function 

speed(); 

//call sharpleft function that turns the car to left a little bit 

driveSlightLeft(); 

}while (error !=0 ); 

else if(error == 101){ 

//call speed function 

speed(); 

//call forwawrd function  

forward(); 

delay(200); 

//call stop function 

stop(); 

read_sensor_values(); 

if (error ==102){ 

do{ 

Serial.print(” do while error”); 

Serial.print(error); 

//call speed function 

speed(); 

//call sharp right function that turns the car to right a little bit 

driveSlightRight(); 

read_sensor_values(); 

} while (error !=0 ); 

}  

else if(error == 102){ 

do{ 

//call speed function 

speed(); 

//call sharp left function 

driveSlightRight(); 
 

read_sensor_values(); 

if (error == 0){ 

//call stop function 

stop(); 

delay(200); 

} while (error !=0 ); 

else if(error == 103){ 

if (flag == 0) 

//call speeed function 

speed(); 

// call forward function 

forward(); 

delay(200); 

//call stop function 

stop(); 

read_sensor_values(); 

if (error == 103) 

//call stop function 

stop(); 

flag = 1; 

else{ 

//call speed function 

speed(); 

//call sharp left function 

driveSlightLeft(); 

delay(200); 

do{ 

read_sensor_values(); 

//call speed function 

speed(); 

//call sharpleft function 

driveSlightLeft(); 

} while (error !=0); 

}  

else{ 

calculating_pid(); 

motor_control(); 

Alinur: 

I have made significant progress with the new car. I successfully established communication between the app interface and the car through Bluetooth. This achievement enables me to send command from the app to the car. Consequently, the car can now be driven via the app, allowing it to turn in all directions. Additionally, the ultrasonic sensors are functioning correctly detecting obstacles Infront of the car, on the left side and on the right side. 

For the upcoming week, my focus will be on implementing line detection sensors. These sensors will enable the car to recognize different lines and patterns, providing guidance for the car to follow. 


Leave a Reply