MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
Public Member Functions | List of all members
MeUltrasonicSensor Class Reference

Driver for Me ultrasonic sensor device. More...

`#include <src/MeUltrasonicSensor.h>`

Inheritance diagram for MeUltrasonicSensor:
[legend]
Collaboration diagram for MeUltrasonicSensor:
[legend]

## Public Member Functions
| MeUltrasonicSensor (void)
| MeUltrasonicSensor (uint8_t port)
void | setpin (uint8_t SignalPin)
double | distanceCm (uint16_t=400)
double | distanceInch (uint16_t=180)
long | measure (unsigned long=30000)
Public Member Functions inherited from MePort
| MePort (void)
| MePort (uint8_t port)
| MePort (uint8_t port, uint8_t slot)
uint8_t | getPort (void)
uint8_t | getSlot (void)
bool | dRead1 (uint8_t mode=INPUT)
bool | dRead2 (uint8_t mode=INPUT)
bool | dpRead1 (void)
bool | dpRead2 (void)
void | dWrite1 (bool value)
void | dWrite2 (bool value)
int16_t | aRead1 (void)
int16_t | aRead2 (void)
void | aWrite1 (int16_t value)
void | aWrite2 (int16_t value)
void | reset (uint8_t port)
void | reset (uint8_t port, uint8_t slot)
uint8_t | pin1 (void)
uint8_t | pin2 (void)
uint8_t | pin (void)
uint8_t | pin (uint8_t port, uint8_t slot)

## Additional Inherited Members
Protected Attributes inherited from MePort
uint8_t | s1
uint8_t | s2
uint8_t | _port
uint8_t | _slot

## Detailed Description

Driver for Me ultrasonic sensor device.

Class: MeUltrasonicSensor

Description
  Declaration of Class MeUltrasonicSensor.

Copyright (C), 2012-2016, MakeBlock

## Constructor & Destructor Documentation

## ◆ MeUltrasonicSensor() [1/2]

MeUltrasonicSensor::MeUltrasonicSensor | ( | void |  | ) |

Alternate Constructor which can call your own function to map the ultrasonic sensor to arduino port, no pins are used or initialized here.

Parameters

  [in] | None |

## ◆ MeUltrasonicSensor() [2/2]

MeUltrasonicSensor::MeUltrasonicSensor | ( | uint8_t | port | ) |

Alternate Constructor which can call your own function to map the ultrasonic Sensor to arduino port

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2

## Member Function Documentation

## ◆ distanceCm()

double MeUltrasonicSensor::distanceCm | ( | uint16_t | MAXcm = `400` | ) |

Function
  distanceCm

Description
  Centimeters return the distance

Parameters

  [in] | MAXcm | - The Max centimeters can be measured, the default value is 400.

Output
  None

Returns
  The distance measurement in centimeters

Others
  None

## ◆ distanceInch()

double MeUltrasonicSensor::distanceInch | ( | uint16_t | MAXinch = `180` | ) |

Function
  distanceInch

Description
  Inch return the distance

Parameters

  [in] | MAXinch | - The Max inch can be measured, the default value is 180.

Output
  None

Returns
  The distance measurement in inch

Others
  None

## ◆ measure()

long MeUltrasonicSensor::measure | ( | unsigned long | timeout = `30000` | ) |

Function
  measure

Description
  To get the duration of the ultrasonic sensor

Parameters

  [in] | timeout | - This value is used to define the measurement range, The default value is 30000.

Output
  None

Returns
  The duration value associated with distance

Others
  None

## ◆ setpin()

void MeUltrasonicSensor::setpin | ( | uint8_t | SignalPin | ) |

Function
  setpin

Description
  Reset the ultrasonic Sensor available PIN by its arduino port.

Parameters

  [in] | SignalPin | - arduino port for sensor read(should analog pin)

Output
  None

Returns
  None

Others
  None

The documentation for this class was generated from the following files:

- src/MeUltrasonicSensor.h
- src/MeUltrasonicSensor.cpp