Robot code for searching an object and charging at it.
Dependencies: HCSR04 Motor mbed
functions.h@27:96a0ff2f474c, 2015-06-07 (annotated)
- Committer:
- lhartfield
- Date:
- Sun Jun 07 17:30:06 2015 +0000
- Revision:
- 27:96a0ff2f474c
- Parent:
- 26:5ee2a32949e6
- Child:
- 30:8a5570b2de68
Fix to move_detect to avoid missing the line
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
abdsha01 | 4:0507835a3dce | 1 | // Header file for functions.cpp |
abdsha01 | 4:0507835a3dce | 2 | |
abdsha01 | 20:37a89edd1cde | 3 | // Global parameters |
abdsha01 | 20:37a89edd1cde | 4 | // Speed at which it move_forwards an object |
abdsha01 | 20:37a89edd1cde | 5 | // optimum value: 0.4 to 0.8 |
lhartfield | 25:7662e93a77eb | 6 | extern float moveforwardspeed; |
abdsha01 | 20:37a89edd1cde | 7 | // Speed at which it rotates to find an object |
abdsha01 | 20:37a89edd1cde | 8 | // optimum value: 0.3 to 0.5 |
abdsha01 | 20:37a89edd1cde | 9 | extern float searchspeed; |
abdsha01 | 20:37a89edd1cde | 10 | // Range of detection |
abdsha01 | 20:37a89edd1cde | 11 | // optimum value: 30 to 50 |
abdsha01 | 20:37a89edd1cde | 12 | extern unsigned int range; |
abdsha01 | 20:37a89edd1cde | 13 | |
alex0612 | 19:67ea4e8be9e1 | 14 | void flash_leds(); |
alex0612 | 19:67ea4e8be9e1 | 15 | void turn_leds_on(); |
abdsha01 | 26:5ee2a32949e6 | 16 | void turn_led_right(); |
abdsha01 | 26:5ee2a32949e6 | 17 | void turn_led_left(); |
abdsha01 | 4:0507835a3dce | 18 | int read_line1(); |
abdsha01 | 4:0507835a3dce | 19 | int read_line2(); |
abdsha01 | 4:0507835a3dce | 20 | int detect_line(); |
lhartfield | 25:7662e93a77eb | 21 | void move_random(float speed=moveforwardspeed); |
abdsha01 | 26:5ee2a32949e6 | 22 | void reverse(float speed = moveforwardspeed); |
abdsha01 | 26:5ee2a32949e6 | 23 | void turn(float speed = moveforwardspeed); |
abdsha01 | 26:5ee2a32949e6 | 24 | void reverse_and_turn(float speed = moveforwardspeed); |
abdsha01 | 26:5ee2a32949e6 | 25 | void move_forward(float speed = moveforwardspeed); |
abdsha01 | 4:0507835a3dce | 26 | void stop(); |
abdsha01 | 26:5ee2a32949e6 | 27 | int detect_object(int range_t = range, float speed = moveforwardspeed); |
lhartfield | 27:96a0ff2f474c | 28 | void move_detect(float speed, int fwd_bck, int time, int wait=0); |