Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GP2Y0E03.h
- Committer:
- jm6wud
- Date:
- 2020-10-21
- Revision:
- 0:9ad6f730f411
- Child:
- 1:4b06b62aca28
File content as of revision 0:9ad6f730f411:
#ifndef GP2Y0E03_H
#define GP2Y0E03_H
#include "mbed.h"
#define DMS_ADDR (0x80)
#define DMS_DIST (0x5E)
#define DMS_RSTADR (0xEE)
#define DMS_RSTCMD (0x06)
#define DMS_128 (0x1)
#define DMS_64 (0x2)
#define DMS_SCALE (0x35)
class GP2Y0E03 {
private:
I2C* i2cRef;
char wdata[2];
char rdata[2];
int status;
public:
GP2Y0E03(I2C* ch);
int writeCommand(char regadr, char dat);
int readData(char regadr, char* dat);
int readDistance(int* dist);
};