Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alkaza authored Nov 30, 2017
1 parent 894e228 commit fd28005
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Update repository
git pull
```
Go to library directory
```
```sh
cd /home/pi/CityScience/src/lib
```
Cleanup static library (if changes were made to static library)
Expand All @@ -21,21 +21,21 @@ Compile static library
make all
```
Go to source directory
```
```sh
cd /home/pi/CityScience/src
```
Remove static library from working directory (if changes were made to static library)
```
```sh
sh /home/pi/CityScience/src/scripts/rmlib.sh
examples
```
Copy static library to examples directory
```
```sh
sh /home/pi/CityScience/src/scripts/cplib.sh
examples
```
Go to examples directory
```
```sh
cd /home/pi/CityScience/src/examples
```
Cleanup all programs (if changes were made to examples)
Expand All @@ -51,7 +51,7 @@ Compile one program
make sensor
```
Run the program
```
```sh
sudo ./sensor
```
Terminate the program
Expand Down Expand Up @@ -82,34 +82,34 @@ int main(void)
- **robot.h** is a static library for the RPiRobot
### Setup function
```
```c
setup ();
```
- Must include to run once
- Allows to terminate the program with Ctrl-C
- Initializes WiringPi, ultrasonic sensor and dc motor driver and

### Infinite loop
```
```c
while (1) {
/* Your code */
}
```
- Put your main code here to run repeatedly

### Calculate distance detected by ultrasonic sensor
```
```c
calc_dist ();
```
- **Recommended distance for obstacle avoidance**: 4~20

### Simple motor control
```
```c
move (direction, speedA, speedB);
```
### Motor control with gradual deceleration
```
```c
move_slow (direction, speedA, speedB);
```
- **Recommended speed range**: 70~150
Expand All @@ -123,21 +123,23 @@ move_slow (direction, speedA, speedB);

### Advanced variables
Change until which speed to decelerate (70 by default)
```
```c
min_speed = speed;
```
Check the previous direction taken
```
prev_dir
```c
if (prev_dir == direction){
/* Your code */
}
```

### Low-level motor control
Set direction
```
```c
setDir (direction);
```
Set speed
```
```c
setSpeed (speedA, speedB);
```

Expand Down

0 comments on commit fd28005

Please sign in to comment.