{"id":8450,"date":"2023-11-12T21:38:35","date_gmt":"2023-11-12T20:38:35","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=8450"},"modified":"2023-11-13T09:12:00","modified_gmt":"2023-11-13T08:12:00","slug":"autonomous-car-week-12","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=8450","title":{"rendered":"Autonomous car &#8211; Week 12"},"content":{"rendered":"\n<p><strong>Abdiqani:<\/strong>&nbsp;<\/p>\n\n\n\n<p>This week I have tried to integrate the communication into Alinur\u2019s 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.&nbsp;&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"735\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-1024x735.png\" alt=\"\" class=\"wp-image-8455\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-1024x735.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-300x215.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-768x552.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-1536x1103.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When I had access to two microbit\u2019s 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.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"715\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-53-1024x715.png\" alt=\"\" class=\"wp-image-8454\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-53-1024x715.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-53-300x209.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-53-768x536.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-53-1536x1072.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-53.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Ghebre:<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.\u00a0The car is driving forward but the left front side get different information.<\/p>\n\n\n\n<p>here is the code i used to control the behavior of the car.<\/p>\n\n\n\n<p>void loop() { &nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>Serial.print(error);&nbsp;<\/p>\n\n\n\n<p>if(error == 100){&nbsp;<\/p>\n\n\n\n<p>do{&nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>\/\/call speed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/call sharpleft function that turns the car to left a little bit&nbsp;<\/p>\n\n\n\n<p>driveSlightLeft();&nbsp;<\/p>\n\n\n\n<p>}while (error !=0 );&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else if(error == 101){&nbsp;<\/p>\n\n\n\n<p>\/\/call speed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/call forwawrd function &nbsp;<\/p>\n\n\n\n<p>forward();&nbsp;<\/p>\n\n\n\n<p>delay(200);&nbsp;<\/p>\n\n\n\n<p>\/\/call stop function&nbsp;<\/p>\n\n\n\n<p>stop();&nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>if (error ==102){&nbsp;<\/p>\n\n\n\n<p>do{&nbsp;<\/p>\n\n\n\n<p>Serial.print(&#8221; do while error&#8221;);&nbsp;<\/p>\n\n\n\n<p>Serial.print(error);&nbsp;<\/p>\n\n\n\n<p>\/\/call speed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/call sharp right function that turns the car to right a little bit&nbsp;<\/p>\n\n\n\n<p>driveSlightRight();&nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>} while (error !=0 );&nbsp;<\/p>\n\n\n\n<p>} &nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else if(error == 102){&nbsp;<\/p>\n\n\n\n<p>do{&nbsp;<\/p>\n\n\n\n<p>\/\/call speed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/call sharp left function&nbsp;<\/p>\n\n\n\n<p>driveSlightRight();&nbsp;<br>&nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>if (error == 0){&nbsp;<\/p>\n\n\n\n<p>\/\/call stop function&nbsp;<\/p>\n\n\n\n<p>stop();&nbsp;<\/p>\n\n\n\n<p>delay(200);&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>} while (error !=0 );&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else if(error == 103){&nbsp;<\/p>\n\n\n\n<p>if (flag == 0)&nbsp;<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>\/\/call speeed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/ call forward function&nbsp;<\/p>\n\n\n\n<p>forward();&nbsp;<\/p>\n\n\n\n<p>delay(200);&nbsp;<\/p>\n\n\n\n<p>\/\/call stop function&nbsp;<\/p>\n\n\n\n<p>stop();&nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>if (error == 103)&nbsp;<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>\/\/call stop function&nbsp;<\/p>\n\n\n\n<p>stop();&nbsp;<\/p>\n\n\n\n<p>flag = 1;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else{&nbsp;<\/p>\n\n\n\n<p>\/\/call speed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/call sharp left function&nbsp;<\/p>\n\n\n\n<p>driveSlightLeft();&nbsp;<\/p>\n\n\n\n<p>delay(200);&nbsp;<\/p>\n\n\n\n<p>do{&nbsp;<\/p>\n\n\n\n<p>read_sensor_values();&nbsp;<\/p>\n\n\n\n<p>\/\/call speed function&nbsp;<\/p>\n\n\n\n<p>speed();&nbsp;<\/p>\n\n\n\n<p>\/\/call sharpleft function&nbsp;<\/p>\n\n\n\n<p>driveSlightLeft();&nbsp;<\/p>\n\n\n\n<p>} while (error !=0);&nbsp;<\/p>\n\n\n\n<p>} &nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else{&nbsp;<\/p>\n\n\n\n<p>calculating_pid();&nbsp;<\/p>\n\n\n\n<p>motor_control();&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Alinur:&nbsp;<\/p>\n\n\n\n<p>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.&nbsp;<\/p>\n\n\n\n<p>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.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"559\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-50.png\" alt=\"\" class=\"wp-image-8451\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-50.png 767w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-50-300x219.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"524\" height=\"605\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-51.png\" alt=\"\" class=\"wp-image-8452\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-51.png 524w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-51-260x300.png 260w\" sizes=\"auto, (max-width: 524px) 100vw, 524px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"735\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-1024x735.png\" alt=\"\" class=\"wp-image-8453\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-1024x735.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-300x215.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-768x552.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52-1536x1103.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-52.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Abdiqani:&nbsp; This week I have tried to integrate the communication into Alinur\u2019s 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 [&hellip;]<\/p>\n","protected":false},"author":98,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8450","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/users\/98"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8450"}],"version-history":[{"count":3,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8450\/revisions"}],"predecessor-version":[{"id":8474,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8450\/revisions\/8474"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}