mirror of
https://github.com/eclipse/upm.git
synced 2025-07-05 11:21:12 +03:00
Added initial interfaces and some sensors implementing them
This commit is contained in:

committed by
Serban Waltter

parent
85608a9f61
commit
e7820f2831
@ -62,3 +62,8 @@ int MAXSONAREZ::inches()
|
||||
|
||||
return int(volts / m_vI);
|
||||
}
|
||||
|
||||
int MAXSONAREZ::getDistance()
|
||||
{
|
||||
return (inches() * 2.54);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <mraa/aio.h>
|
||||
#include <interfaces/iDistance.hpp>
|
||||
|
||||
// EZ series is volts/512
|
||||
#define MAXSONAREZ_RES 512
|
||||
@ -67,7 +68,7 @@ namespace upm {
|
||||
* @snippet maxsonarez.cxx Interesting
|
||||
*/
|
||||
|
||||
class MAXSONAREZ {
|
||||
class MAXSONAREZ : virtual public iDistance {
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -90,6 +91,13 @@ namespace upm {
|
||||
*/
|
||||
int inches();
|
||||
|
||||
/**
|
||||
* Gets the distance to the object in inches
|
||||
*
|
||||
* @return Distance to the object in inches
|
||||
*/
|
||||
virtual int getDistance();
|
||||
|
||||
private:
|
||||
mraa_aio_context m_aio;
|
||||
float m_aref;
|
||||
|
Reference in New Issue
Block a user