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
00001 #ifndef GP2Y0E03_H 00002 #define GP2Y0E03_H 00003 00004 #include <mbed.h> 00005 #include <I2C.h> 00006 00007 #define DMS_ADDR (0x80) 00008 #define DMS_DIST (0x5E) 00009 #define DMS_RSTADR (0xEE) 00010 #define DMS_RSTCMD (0x06) 00011 #define DMS_128 (0x1) 00012 #define DMS_64 (0x2) 00013 #define DMS_SCALE (0x35) 00014 00015 class GP2Y0E03 { 00016 private: 00017 I2C* i2cRef; 00018 char wdata[2]; 00019 char rdata[2]; 00020 int status; 00021 00022 public: 00023 GP2Y0E03(I2C* ch); 00024 int writeCommand(char regadr, char dat); 00025 int readData(char regadr, char* dat); 00026 int readDistance(int* dist); 00027 }; 00028 #endif // GP2Y0E03_H
Generated on Sat Jul 23 2022 10:51:16 by
1.7.2