This shows you the differences between two versions of the page.
pm:prj2022:robert:mini_wall-e [2022/05/27 19:00] ovidiu.ghibea [How It Works] |
pm:prj2022:robert:mini_wall-e [2022/05/27 19:33] (current) ovidiu.ghibea [Jurnal] |
||
---|---|---|---|
Line 76: | Line 76: | ||
delay(10); | delay(10); | ||
</code> | </code> | ||
- | The second scenario is when the switch is on, so the circuit is not active. | + | If the distance is greater than the defined distance means there is not obstacle in its path and it will moving in forward direction. |
<code cpp> | <code cpp> | ||
- | if (digitalRead(BUTTON) == HIGH) // toy is turned off | + | if (distance > 19) |
- | { | + | { |
- | sequenceNumber = 0; | + | digitalWrite(fwdright7, HIGH); // move forward |
- | player.stop(); | + | digitalWrite(revright6, LOW); |
- | digitalWrite(LEDRED, LOW); | + | digitalWrite(fwdleft5, HIGH); |
- | digitalWrite(LEDRIGHT, LOW); | + | digitalWrite(revleft4, LOW); |
- | digitalWrite(LEDMIDDLE, LOW); | + | } |
- | digitalWrite(LEDLEFT, LOW); | + | |
- | } | + | |
</code> | </code> | ||
- | Additionally, depending on the length of track 1 used in the arming sequence, we will choose a number of times the respective if{} statement will be repeated. In this case it, is repeated 12 times. | + | If the distance is less than the defined distance to avoid obstacle means there is some obstacle ahead. So in this situation robot will stop for a while and movebackwards after that again stop for a while and then take turn to another direction. |
+ | <code cpp> | ||
+ | if (distance < 18) | ||
+ | { | ||
+ | digitalWrite(fwdright7, LOW); //Stop | ||
+ | digitalWrite(revright6, LOW); | ||
+ | digitalWrite(fwdleft5, LOW); | ||
+ | digitalWrite(revleft4, LOW); | ||
+ | delay(500); | ||
+ | digitalWrite(fwdright7, LOW); //movebackword | ||
+ | digitalWrite(revright6, HIGH); | ||
+ | digitalWrite(fwdleft5, LOW); | ||
+ | digitalWrite(revleft4, HIGH); | ||
+ | delay(500); | ||
+ | digitalWrite(fwdright7, LOW); //Stop | ||
+ | digitalWrite(revright6, LOW); | ||
+ | digitalWrite(fwdleft5, LOW); | ||
+ | digitalWrite(revleft4, LOW); | ||
+ | delay(100); | ||
+ | digitalWrite(fwdright7, HIGH); | ||
+ | digitalWrite(revright6, LOW); | ||
+ | digitalWrite(revleft4, LOW); | ||
+ | digitalWrite(fwdleft5, LOW); | ||
+ | delay(500); | ||
+ | } | ||
+ | </code> | ||
+ | This is how a robot can avoid obstacles in its path without getting stuck anywhere. | ||
===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
Line 98: | Line 121: | ||
===== Concluzii ===== | ===== Concluzii ===== | ||
+ | After finishing the project, I learned that:\\ | ||
+ | *While the code is simple, the hardest part was the making of the chasis. | ||
+ | |||
+ | *Some parts have very tough bolts to unscrew which led to a lot of wasted time | ||
+ | |||
+ | *It was fun to see it work after all the effort put in it | ||
+ | |||
===== Download ===== | ===== Download ===== | ||
- | <note warning> | + | {{:pm:prj2022:robert:obsav.rar|Source Code}} |
- | O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). | + | |
- | Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:pm:prj20??:c?** sau **:pm:prj20??:c?:nume_student** (dacă este cazul). **Exemplu:** Dumitru Alin, 331CC -> **:pm:prj2009:cc:dumitru_alin**. | + | {{:pm:prj2022:robert:rob.png?linkonly|Electric Diagram}} |
- | </note> | + | |
- | ===== Jurnal ===== | ||
- | |||
- | <note tip> | ||
- | Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. | ||
- | </note> | ||
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
- | <note> | + | *[[https://store.arduino.cc/products/arduino-uno-rev3/|Arduino UNO]] |
- | Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. | + | *[[https://www.newark.com/stmicroelectronics/l298n/ic-bridge-driver-dual-298/dp/10WX1394?rpsku=rel1:32M1527&isexcsku=false|SparkFun Dual H-Bridge motor drivers L298]] |
- | </note> | + | *[[https://www.sparkfun.com/products/15569|SparkFun Ultrasonic Sensor - HC-SR04]] |
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||