WALL-E Version 1.0
The "WALL-E" Project is a ME 507 quarter term project inspired to recreate the robot WALL-E. The WALL-E robot is a fully 3D printed robot with modified components in order to fit the needs of the chosen peripherals and electronics. WALL-E contains a custom made PCB which is housed in the main body of WALL-E. WALL-E's peripherals and components include 2 pololu Romi Motors with encoders, 4 MG90s servos, BNO055 IMU, and a OV2640 ArduCam camera. The objective of WALL-E is to scan the surrounding area for the closest object to it. Once that object is detected, WALL-E drives up to the object, attempts to pick up or hold the object and detect the color of the object.
Loading...
Searching...
No Matches
hcsr04.h
Go to the documentation of this file.
1/* USER CODE BEGIN Header */
20
21#ifndef INC_HCSR04_H_
22#define INC_HCSR04_H_
23
24#include "stm32f4xx_hal.h"
25
29class HCSR04 {
30 public:
31 HCSR04(GPIO_TypeDef* trigPort, uint16_t trigPin,
32 GPIO_TypeDef* echoPort, uint16_t echoPin,
33 TIM_HandleTypeDef* htim);
34
35 void trigger(); // Triggers a measurement
36 bool measure(); // Performs blocking measurement
37 uint32_t getDistanceCm(); // Returns distance in cm
38
39 private:
43 GPIO_TypeDef* trigPort;
44
48 uint16_t trigPin;
49
53 GPIO_TypeDef* echoPort;
54
58 uint16_t echoPin;
59
63 TIM_HandleTypeDef* htim;
64
68 uint32_t distanceCm;
69};
70
71#endif /* INC_HCS04_H_ */
bool measure()
Function if the sensor is ready to measure the function triggers then calculates the distance an obje...
Definition hcsr04.cpp:56
uint32_t distanceCm
Definition hcsr04.h:68
uint16_t trigPin
Definition hcsr04.h:48
TIM_HandleTypeDef * htim
Definition hcsr04.h:63
uint32_t getDistanceCm()
Function allows the user to extract the Distance in cm the object is.
Definition hcsr04.cpp:85
HCSR04(GPIO_TypeDef *trigPort, uint16_t trigPin, GPIO_TypeDef *echoPort, uint16_t echoPin, TIM_HandleTypeDef *htim)
Constructor Function that initializes the class variables/instances.
Definition hcsr04.cpp:26
uint16_t echoPin
Definition hcsr04.h:58
GPIO_TypeDef * echoPort
Definition hcsr04.h:53
GPIO_TypeDef * trigPort
Definition hcsr04.h:43
void trigger()
Function Triggers the 10us Pulse on the trigger pin to be read from the echo pin.
Definition hcsr04.cpp:41