Uses 2 HC-SR04 ultrasonic modules to steer the RenBuggy away from obstacles. Renishaw Team page fork.
Dependencies: mbed
Fork of RenBuggy_Ultrasonic by
Diff: ultrasonic_buggy.h
- Revision:
- 1:80c2ef16a42f
- Parent:
- 0:fbceffb594b6
diff -r fbceffb594b6 -r 80c2ef16a42f ultrasonic_buggy.h --- a/ultrasonic_buggy.h Thu Jul 14 12:58:48 2016 +0000 +++ b/ultrasonic_buggy.h Mon Jul 18 10:00:29 2016 +0000 @@ -24,18 +24,18 @@ #define LEFT_ECHO_PIN P1_20 #define RIGHT_ECHO_PIN P0_12 -#define SPEED_OF_SOUND 340 //speed of sound =~340m/s at standard conditions +#define SPEED_OF_SOUND 340 //speed of sound =~340m/s at standard conditions /* these are function prototypes that declare all the functions in the library.*/ -extern void forward(float); //Move the buggy forward for (float) seconds -extern void left(float); //Turn left for (float) seconds -extern void right(float); //Turn right for (float) seconds -extern void hold(float); //Hold the buggy in an idle state for (float) seconds -extern void stop(); //Stop all motors +extern void forward(float); //Move the buggy forward for (float) seconds +extern void left(float); //Turn left for (float) seconds +extern void right(float); //Turn right for (float) seconds +extern void hold(float); //Hold the buggy in an idle state for (float) seconds +extern void stop(); //Stop all motors -extern float getDistance_l(void); -extern float getDistance_r(void); -void resetSR04(void); +extern float getDistance_l(void); //get a distance reading in metres from the left sensor +extern float getDistance_r(void); //get a distance reading in metres from the right sensor +void resetSR04(void); //reset both ultrasonic modules #endif // BUGGY_FUNCTIONS_H \ No newline at end of file