Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hala #44

Merged
merged 8 commits into from
Jan 5, 2023
Merged

Hala #44

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/algorithm.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
algorithm
# Algorithm
## Path finding and A*
## Movment
### General Algorithm of movment

11 changes: 11 additions & 0 deletions lib/resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Resources

### Using L298N Dual H-Bridge to control of DC motors:
https://dronebotworkshop.com/dc-motors-l298n-h-bridge/

### Using Ultrasonic sensor:
https://www.maxbotix.com/articles/how-ultrasonic-sensors-work.htm

### A* Algorithm


23 changes: 22 additions & 1 deletion lib/schematics/components.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
components
# Circuit and Schematics
## 1. Circuit


## 2. Components
- Arduino Uno.
- L298N Dual H-bridge.
- HC-SR04 Ultrasonic sensor.
- 2 DC motors.
- Battery 6v.
- BreadBoard.
- Wires.

- ### L298N Dual H-bridge



- ### HC-SR04 Ultrasonic senso
Ultrasonic sensors work by emitting sound waves at a frequency too high for humans to hear. then wait for the sound to be reflected back, calculating distance based on the time required.
calculated based on this formula: Distance = ½ T x C

T = Time and C = the speed of sound
12 changes: 6 additions & 6 deletions src/full_workable_version_1/full_workable_version_1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ void right() {
@param None.
@return None.
*/
void stop_robot() {
void stopRobot() {
if (test_arduino) pr_s("stop_robot"); ln();
//Stop the motors
digitalWrite(in1, LOW);
Expand Down Expand Up @@ -636,7 +636,7 @@ long calcDistance() {
@param None.
@return the value of J index .
*/
int return_indexJ() {
int returnIndexJ() {
if (direction == 0) {
return j - 1;
}
Expand All @@ -654,7 +654,7 @@ int return_indexJ() {
@param None.
@return the value of i index .
*/
int return_indexI() {
int returnIndexI() {
if (direction == 0 || direction == 2) {
return i;
}
Expand Down Expand Up @@ -789,8 +789,8 @@ boolean leftOpen() {
}
}
void set_obstecal() {
int y = (map_size_rows - 1) - return_indexI();
int x = (map_size_cols - 1) - return_indexJ();
int y = (map_size_rows - 1) - returnIndexI();
int x = (map_size_cols - 1) - returnIndexJ();
pr_s("x=");pr(x);pr_s("y="); pr(y); ln();
ind[y][x] = OBST;
pr_s("!! = "); pr(ind[y][x]); ln();
Expand Down Expand Up @@ -818,7 +818,7 @@ void loop() {
}
if (calcDistance() < 35) {
calc_matrix_wave = 1; // we can recalc path
stop_robot();
stopRobot();
clean_path();
// set_obstecal();
int y = (map_size_rows - 1) - return_indexI();
Expand Down
2 changes: 1 addition & 1 deletion src/movment_with_millis/movment_with_millis.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int in4 = 4;
int trigPin = 11; // Trigger
int echoPin = 10; // Echo
long duration, cm;

// 0 is up
// 1 is right
// 2 is down
// 3 is left
Expand Down