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 Class Reference

WALL-E Ultrasonic Sensor Class for range and distance detection from an object. More...

#include <hcsr04.h>

Public Member Functions

 HCSR04 (GPIO_TypeDef *trigPort, uint16_t trigPin, GPIO_TypeDef *echoPort, uint16_t echoPin, TIM_HandleTypeDef *htim)
 Constructor Function that initializes the class variables/instances.
void trigger ()
 Function Triggers the 10us Pulse on the trigger pin to be read from the echo pin.
bool measure ()
 Function if the sensor is ready to measure the function triggers then calculates the distance an object is away from the sensor and updates it's variable.
uint32_t getDistanceCm ()
 Function allows the user to extract the Distance in cm the object is.

Private Attributes

GPIO_TypeDef * trigPort
uint16_t trigPin
GPIO_TypeDef * echoPort
uint16_t echoPin
TIM_HandleTypeDef * htim
uint32_t distanceCm

Detailed Description

WALL-E Ultrasonic Sensor Class for range and distance detection from an object.

Constructor & Destructor Documentation

◆ HCSR04()

HCSR04::HCSR04 ( GPIO_TypeDef * trigPort,
uint16_t trigPin,
GPIO_TypeDef * echoPort,
uint16_t echoPin,
TIM_HandleTypeDef * htim )

Constructor Function that initializes the class variables/instances.

Member Function Documentation

◆ getDistanceCm()

uint32_t HCSR04::getDistanceCm ( )

Function allows the user to extract the Distance in cm the object is.

Returns
uint32_t

◆ measure()

bool HCSR04::measure ( )

Function if the sensor is ready to measure the function triggers then calculates the distance an object is away from the sensor and updates it's variable.

Returns
Boolean

◆ trigger()

void HCSR04::trigger ( )

Function Triggers the 10us Pulse on the trigger pin to be read from the echo pin.

Returns
None

Member Data Documentation

◆ distanceCm

uint32_t HCSR04::distanceCm
private

Private variable distanceCm that holds the centimeter readings from the HCSR04 Sensor

◆ echoPin

uint16_t HCSR04::echoPin
private

Private variable echoPin that takes in the Echo GPIO pin value

◆ echoPort

GPIO_TypeDef* HCSR04::echoPort
private

Private variable trigPort that takes in the trigger Port definition from the STM32 Config

◆ htim

TIM_HandleTypeDef* HCSR04::htim
private

Private variable htim that takes in the Timer definition from the STM32 Config

◆ trigPin

uint16_t HCSR04::trigPin
private

Private variable trigPin that takes in the trigger GPIO pin value

◆ trigPort

GPIO_TypeDef* HCSR04::trigPort
private

Private variable trigPort that takes in the trigger Port definition from the STM32 Config


The documentation for this class was generated from the following files:
  • C:/Users/arath/OneDrive/Documents/ME 507/Project-WALLE/Code/Inc/hcsr04.h
  • C:/Users/arath/OneDrive/Documents/ME 507/Project-WALLE/Code/src/hcsr04.cpp