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.
Diff: GP2Y0E03.h
- Revision:
- 0:9ad6f730f411
- Child:
- 1:4b06b62aca28
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GP2Y0E03.h Wed Oct 21 12:55:00 2020 +0000
@@ -0,0 +1,26 @@
+#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);
+};